Sorry, there is an error:
Code:
function carousel() {
var containers = document.getElementsByClassName("slideContainer");
for (var i = 0; i < containers.length; i++ ) {
var slides = containers[i].getElementsByClassName("mySlides");
for (var j = 0; j < slides.length; j++) {
slides[j].style.display = "none";
}
slides[myIndex - 1].style.display = "block";
}
myIndex++;
if (myIndex > slides[0].length) { // error here
myIndex = 1
}
setTimeout(carousel, 2000);
}
This is correct:
Code:
if (myIndex > slides.length)
Note, that there is a limitation in this script: All slideshows must have the same number of images.