我对幻灯片有疑问。有什么方法我可以看到图像淡入淡出..
Here是一个小提琴。
function cycleImages(){
var $active = $('#cycler .active');
var $next = ($active.next().length > 0) ? $active.next() : $('#cycler img:first');
$next.css('z-index',2);//move the next image up the pile
$active.fadeOut(1500,function(){//fade out the top image
$active.css('z-index',1).show().removeClass('active');//reset the z-index and unhide the image
$next.css('z-index',3).addClass('active');//make the next image the top one
});
}
$(document).ready(function(){
// run every 4s
setInterval('cycleImages()', 4000);
})
答案 0 :(得分:0)
你有一个开始,我想你一旦改变它就能弄清楚:
setInterval('cycleImages()', 4000);
到此:
setInterval(function(){cycleImages()}, 4000);
然后从那里修复你的代码。