我正在运行一个随机图像fadeOut序列工作正常,但实际的淡入淡出序列是生涩的
var speed = 300;
timer= setInterval(function(){
$notLoaded = $(".cover").not(".loaded");
$notLoaded.eq(Math.floor(Math.random()*$notLoaded.length)).fadeOut(500).addClass("loaded");
if ($notLoaded.length == 0) {
clearInterval(timer);
}
}, speed);
答案 0 :(得分:0)
我不记得.fadeOut(500)
是 jerky ...
您总是可以选择CSS3过渡
<强> jsBin demo 强>
CSS:
.loaded{
transition:0.5s;
opacity: 0;
}
var speed = 300;
timer = setInterval(function(){
$notLoaded = $(".cover").not(".loaded");
$notLoaded.eq(Math.floor(Math.random()*$notLoaded.length)).addClass("loaded");
if ($notLoaded.length === 0) {
clearInterval(timer);
}
}, speed);