For a mouseout event, the event target is the thing you're leaving - mousing out of - the event relatedTarget is the thing you're leaving to, or entering.
jQuery('#something').mouseout(function(e){
/*
don't close the subnav if we've moused out -> onto an autocomplete resultset.
*/
var targ = e.relatedTarget, i = 0;
//we're only checking the most recent 5 parents (ancestors).
while(targ && ++i<5){
//don't close the subnav if we're mousing over an autocomplete list.
if(targ.className && targ.className.indexOf('ac_results')>-1){
return;
}
targ = targ.parentNode;
}
/**/
//ok, close me..
$(this).hide();
});
No comments:
Post a Comment