尝试了几个选项后,我无法使文本淡入淡出。 无论我尝试什么,整个动画都会卡住,即使添加这样的东西也是如此
$("#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
最佳答案
改变
$("#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/