这是 js 代码。
var index = 0;
函数 InfinitiveSwitching() { var items = $(".box li");
var previousIndex = index - 1;
if (0 > previousIndex) {
previousIndex = $(items).length - 1;
}
var previousImage = $(items).get(previousIndex);
$(previousImage).removeClass('current');
var currentImage = $(items).get(index);
$(currentImage).removeClass('second');
$(currentImage).addClass('current');
index++;
if (index >= $(items).length) {
index = 0;
}
var secondImage = $(items).get(index);
$(secondImage).addClass('second');
window.setTimeout(function () { InfinitiveSwitching() }, 1000)
}
祝你好运