gpt4 book ai didi

javascript - 以下演示中的 FadeIn 和 fadeOut

转载 作者:行者123 更新时间:2023-11-28 13:24:10 25 4
gpt4 key购买 nike

尝试了几个选项后,我无法使文本淡入淡出。无论我尝试什么,整个动画都会卡住,即使添加这样的东西也是如此

$("#headertxt".fadeIn('slow').css({"display" : "block"});

$("#headerimg" + currentContainer).fadeOut(function() {
setTimeout(function() {
$("#headertxt".fadeIn({"display" : "block"});
animating = false;
}, 500);
});

$("#headerimg" + currentContainer).fadeOut(function() {
setTimeout(function() {
$("#headertxt".fadeOut({"display" : "block"});
animating = false;
}, 5000);
});

这是原文demo

here's jfiddle

最佳答案

改变

$("#headertxt".fadeIn('slow').css({"display" : "block"}); //this will not work

$("#headertxt").fadeIn('slow', function(){
$(this).css('display', 'block');
});
// apply css after animation.

关于javascript - 以下演示中的 FadeIn 和 fadeOut,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14368534/

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