I am new at Jquery and I am trying to make a menu to show up on hover with fadeIn and when the mouse leaves to start a delay and then close the menu with fadeout.
My code so far... I made a jsFiddle too JSFIDDLE
$('#menu > li').on('mouseover', function(e){
$(this).find("ul:first").stop().fadeIn(120);
$(this).find('> a').addClass('active');
}).on('mouseout', function(e){
$(this).find("ul:first").stop().delay(2000).fadeOut(120);
$(this).find('> a').removeClass('active');
});
Change the sequence of
delay
andstop
and use longerfadeOut
duration.Demo: http://jsfiddle.net/tusharj/YGB5G/39/
EDIT
You can also use
hover
as follow:Demo: http://jsfiddle.net/tusharj/YGB5G/43/