gpt4 book ai didi

jquery - 淡入 jquery [不工作]

转载 作者:行者123 更新时间:2023-12-01 04:45:06 25 4
gpt4 key购买 nike

我是 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com