我无法正常工作,我只是想让图像无限循环。什么不在这里?X毫秒后替换并循环显示图像
var croppingImages = new Array()
croppingImages[0] = "https://img.f1today.eu/x/topstory/58c7e187745517a1c90fc5ebe21c55da49223c999500b.jpg";
croppingImages[1] = "https://pbs.twimg.com/media/C69Y8aWW0AEkCIW.jpg:small";
setTimeout("animateImages()", 100);
var cropImg = 0;
function animateImages() {
document.getElementById("cropping__animation").src = croppingImages[cropImg]
x++;
}
<img src="https://img.f1today.eu/x/topstory/58c7e187745517a1c90fc5ebe21c55da49223c999500b.jpg" id="cropping__animation">
你没有定义'x'。您只需调用一次'animateImages'。 – dfsq
我添加了cropImg ++,但它仍然没有工作: @dfsq – GoldenGonaz