0
在這個例子中,我有3張幻燈片。當我的上一張幻燈片顯示完畢後,它不會返回到第一張幻燈片。幻燈片不能返回到第一張幻燈片
我不明白爲什麼它不返回到第一張幻燈片。
<script type="text/javascript">
$(document).ready(function() {
showSlide(0); // show first slide when DOM loaded
});
function showSlide(x) { // x = the number of slide
$('.boxslideshow .wrap').hide(); // hide all slides
$('.boxslideshow .wrap').eq(x).css('display', 'block'); // show a slide
setTimeout(function(){
var slides = $('.boxslideshow .wrap').length; // total number of slides
if (slides == 0) { // if last slide return to first slide
showSlide(0);
} else {
showSlide(x+1); // call function showSlide to display all slides
}
}, 2000); // timer
}
</script>