gpt4 book ai didi

javascript - jquery - fadeOut 回调并不总是执行

转载 作者:行者123 更新时间:2023-11-29 20:00:22 24 4
gpt4 key购买 nike

我的部分代码:

        anObject.fadeOut(fadeOutTime, function(){
anObject.css('display', 'none');
console.log("inside the callback");
veryImportantMethod();

});

不幸的是,回调似乎还没有执行。我什至尝试调试它并注意到有时它只是跳过回调函数的主体并跳出......为什么?

最佳答案

如果是这种情况,则使用 .promise().done():

anObject.fadeOut(fadeOutTime).promise().done(function(){
anObject.css('display', 'none');
console.log("inside the callback");
veryImportantMethod();
});

关于javascript - jquery - fadeOut 回调并不总是执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14830591/

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