Jquery: encasing div and anchor link binded to same event.

Posted by centr0 on Stack Overflow See other posts from Stack Overflow or by centr0
Published on 2010-04-05T18:24:35Z Indexed on 2010/04/05 18:33 UTC
Read the original article Hit count: 189

Filed under:
|
|

im having trouble figuring out how to bind mouseout() to my entire nav bar including the links.

when a user hovers over a link in #nav a sub menu is shown. all is well there.

what i want to do is fadeOut that sub menu when the user hovers out of the entire #nav.

my code for the mouseout:

$('#nav').mouseout(function() {
  setTimeout(function() {
   //$('.sub-link').fadeOut();
  }, 2000);
});

when i hover over an anchor link which resides in #nav, i see the sub-menu. then i guess the mouseout() even fires and the sub-menu fades out. is there anyway to have the #nav and any anchor links within it to act as one?

i'd paste my markup but even indenting it 4 spaces still shows as rendered html..

TIA

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about event