Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Best practice: Remove active state from dropdown menu Re: Best practice: Remove active state from dropdown menu

#105337
sBowers
Participant

We do something similar with a navigation bar. But we test to see if you are clicking inside first.


//Hide the Header Tool Bar when you click out
var mouse_is_inside_toolbar = false;

$('.global-nav').hover(function(){
mouse_is_inside_toolbar=true;
}, function(){
mouse_is_inside_toolbar=false;
});

$("body").mouseup(function(){
if(! mouse_is_inside_toolbar) {
hide_global_nav();
}
});