如何删除幻灯片中的暂停?

时间:2013-04-07 05:26:43

标签: jquery css

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);
});

1 个答案:

答案 0 :(得分:0)

未经过测试,但您可以尝试以这种方式使用setInterval代替setTimeout

$(function () {
    $('#slideshow img').not('.active').hide()
    setInterval(slideSwitch, 8000);    // this depends on how many images there are 
});