JQuery fadeOut(function(){fadeIn}); [英] JQuery fadeOut(function(){fadeIn});
本文介绍了JQuery fadeOut(function(){fadeIn});的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网页有问题。
我有4个div,它们应该在淡出之后逐渐消失。我使用的代码是:
I have a problem with my webpage. I have 4 div's which should all fade in after the one before fades out. The code I use is:
$('.btn').click(function(){
$('#box3').delay(5000).fadeOut('slow', function(){
$('#box4').fadeIn('slow');
});
});
使用#box1>#box2它可以正常工作,#box2>#box3它可以工作,但是当我尝试从#box3>#box4开始有时#box3淡出然后用#box4淡入。我不知道为什么会这样做。
With #box1 > #box2 it works, with #box2 > #box3 it works but when I try to go from #box3 > #box4 sometimes #box3 fades out then fades in with #box4. I have No idea why it is doing this.
谢谢,
http://jsfiddle.net/chLRa/4/ 正在运行。有时当从3到4时它仍然在3和4中消失
http://jsfiddle.net/chLRa/4/ now working. Sometimes when going from 3 to 4 it still fades in 3 and 4
推荐答案
这是一个简单的帮助函数来帮助你做到这一点。
Here's a simple helper function to help you do this.
function fade(thisIn, callback){
boxes.not(thisIn).filter(':visible').delay(5000).fadeOut('slow', function(){
thisIn.fadeIn('slow', callback);
});
}
这篇关于JQuery fadeOut(function(){fadeIn});的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文