FadeIn jquery [not working]

67 views Asked by At

I am new at jquery and my fadeIn is not working. I made a JSFIDDLE here. Thank you

$('#menu > li').on('mouseover', function(e){
  $(this).find("ul:first").fadeIn(120).finish();
  $(this).find('> a').addClass('active');
}).on('mouseout', function(e){
  $(this).find("ul:first").stop().finish().delay(500).fadeOut(120);
  $(this).find('> a').removeClass('active');
});

1

There are 1 answers

5
lmgonzalves On BEST ANSWER

Remove .finish():

$('#menu > li').on('mouseover', function(e){
  $(this).find("ul:first").fadeIn(120);
  $(this).find('> a').addClass('active');
}).on('mouseout', function(e){
  $(this).find("ul:first").stop().finish().delay(500).fadeOut(120);
  $(this).find('> a').removeClass('active');
});

FIDDLE: https://jsfiddle.net/YGB5G/47/

From jQuery site:

When .finish() is called on an element, the currently-running animation and all queued animations (if any) immediately stop and their CSS properties set to their target values. All queued animations are removed.