我是 jquery 新手,我的 fadeIn 不起作用。我做了一个JSFIDDLE这里。谢谢
$('#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');
});
最佳答案
删除.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/
来自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.
关于jquery - 淡入 jquery [不工作],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30875471/