我做了一个简单的循环,使 div#1 淡入/淡出,然后 div#2 淡入/淡出我写的代码是这样的:
function runToggle(iDuration, domFirst,domSecond) {
$(domFirst).fadeToggle(iDuration, "linear",function() {
$(domFirst).fadeToggle(iDuration, "linear",function() {
$(domSecond).fadeToggle(iDuration,"linear",function() {
$(domSecond).fadeToggle(iDuration,"linear",function() {
setTimeout(function() {
runToggle(iDuration, domFirst,domSecond) ;
},50);
});
});
});
});
};
runToggle(2000, $('#box1'),$('#box2'));
但我似乎无法在每次淡入和淡出之间进行延迟......(从逻辑上讲,我想要的是:div1 Fade in,Delay,div1 Fade out,div2 fade in,delay,div2 fade out,然后重新开始.