这可行,但我假设有一种更有效的方法可以实现同样的效果。我的意图是重置最后一张幻灯片上的功能,使其循环播放。
http://jsfiddle.net/andrewtamala/JVgAC/3/
$(document).ready(function(){
var i = $(".slide").length;
$('.button').click(function() {
i--;
$('.slide').eq(i).animate({"top" : "500"}, 200)
.animate({"opacity" : "0", "top" : "000"}, 1)
.animate({"opacity" : "1"});
if (i === -1) {
i++;
i++;
i++;
i++;
}
})
});