最後和第一滑動之間的空白間隙見下面的jsFiddle和代碼:使用的.next()與jQuery
function slider() {
var activeSlide = $(".slideshow img.active");
var firstSlide = $(".slideshow img:first-of-type");
var lastSlide = $(".slideshow img:last-of-type");
activeSlide
.removeClass("active")
.next()
.addClass("active");
if (activeSlide.length === 0) {
firstSlide.addClass("active");
}
}
setInterval(function() {
slider();
}, 3000);
一旦它到達最後一張幻燈片,有前回去的暫停和空白間隙到第一張幻燈片。
有關如何解決此問題的任何建議?當我檢查元素時,我可以看到「活動」類循環通過,但在最後一次重新出現之前,它會消失一秒鐘。
在此先感謝您的任何建議。
這就是一個!感謝您的回覆,謝謝! – Pete