I'm using w3 school's automatic slider code on my Tumblr page. Now, I looked high and low on here and have seen several people having similar issues with this same code, but I haven't found any solutions unfortunately. Upon loading, it will cycle through the 3 slides and then disappear, just leaving the dots behind. You can see at http://rachelmontano.com
I'm pretty positive the issue is with the javascript and not something to do with the CSS or HTML - I've double checked that all of my classes match and I don't have any random/unnecessary bits of HTML floating around or anything. No errors in inspect until it finishes the cycle and disappears. Once that happens, this is the error I get, but I have no idea how to decipher this lol >>I am a JS noob, I'm so sorry<<
Uncaught TypeError: Cannot read property 'style' of undefined
at showSlides ((index):985)
showSlides @ (index):985
setTimeout (async)
showSlides @ (index):987
setTimeout (async)
showSlides @ (index):987
setTimeout (async)
showSlides @ (index):987
(anonymous) @ (index):971
Here's the JS snippet
<script>
var slideIndex = 0;
showSlides();
function showSlides() {
var i;
var slides = document.getElementsByClassName("slips");
var dots = document.getElementsByClassName("bottomdots");
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
slideIndex++;
if (slideIndex > slides.length) {slideIndex = 1}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" activedot", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " activedot";
setTimeout(showSlides, 3000); // Change image every 2 seconds
}
</script>
edit: here's a screenshot of my website code just so you can see that {slideIndex=1} is in my website code, but something is apparently managing to remove it once you check it in inspect!?!? I don't even...