Line 119: | Line 119: | ||
var i; | var i; | ||
var slides = document.getElementsByClassName("mySlides"); | var slides = document.getElementsByClassName("mySlides"); | ||
+ | var dots = document.getElementsByClassName("dot"); | ||
if (n > slides.length) {slideIndex = 1} | if (n > slides.length) {slideIndex = 1} | ||
if (n < 1) {slideIndex = slides.length} | if (n < 1) {slideIndex = slides.length} | ||
Line 124: | Line 125: | ||
slides[i].style.display = "none"; | slides[i].style.display = "none"; | ||
} | } | ||
+ | for (i = 0; i < dots.length; i++) { | ||
+ | dots[i].className = dots[i].className.replace(" active", ""); | ||
+ | } | ||
+ | slides[slideIndex-1].style.display = "block"; | ||
+ | dots[slideIndex-1].className += " active"; | ||
} | } | ||
</script> | </script> |
Revision as of 19:41, 16 October 2018