0

http://kennenmen.netai.net/home.php

我已经玩了几个小时了,它几乎完成了。唯一给我带来麻烦的是我似乎无法弄清楚为什么我的幻灯片在循环播放所有图像后会暂停。有人知道它为什么这样做吗?

function slideSwitch() {
 var $active = $('#slideshow img.active');
if ($active.is(':last')) {
    $active.hide().removeClass('active');
    $('#slideshow img:first').show().addClass('active');
}else{
    $active.hide().removeClass('active').next().show().addClass('active');
}
}

$(function () {
$('#slideshow img').not('.active').hide()
setInterval(slideSwitch, 1000);
});
4

1 回答 1

0

未经测试,但您可以尝试以这种方式使用,而setInterval不是setTimeout

$(function () {
    $('#slideshow img').not('.active').hide()
    setInterval(slideSwitch, 8000);    // this depends on how many images there are 
});
于 2013-04-07T06:40:13.407 回答