Fade out jQuery menu after delay
问题 I'm working on a jQuery drop-down menu that fades in when you hover on the top-level items. I want to set it so that when you move the mouse away the menu doesn't disappear instantly. I have this code: $(document).ready(function(){ $('ul#menu > li').hover( // mouseover function(){ $(this).find('>ul').fadeIn('fast'); }, // mouseout function(){ setTimeout( function(){ alert('fadeout'); $(this).find('>ul').fadeOut('fast') }, 1000 ); } ); }); After a second the alert happens, but the menu isn't