更新时间:2022-12-08 22:28:55
您可以轻松计算切换功能中的下一个图像。
这样你就不会弄乱你的var空间;)
You may easily calculate the next image within the switch function. This way you won't mess up your var space ;)
(function switchToImage(img) {
$(img).click()
var images = $('#thumbs img');
var nextIndex = ($.inArray(images, img) + 1) % images.length;
setTimeout(function() {
switchToImage(images[nextIndex])
}, 5000);
})($('#thumbs img')[0]);