I'm having trouble with my slideshow. I want it to run automatically and also have manual controls, but there are some issues. When I try to manually control the slides, it takes me to the wrong slide and messes up the timing for the next few slides. Does anyone have a solution?
I've attempted changing the slideIndex to 0, but that just takes me back to the first slide instead of advancing to the next one.
var slideIndex = 0;
showSlides(slideIndex);
function plusSlides(n) {
showSlides(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
// rest of the JavaScript code...
* {box-sizing: border-box;}
// CSS styles...
< h2>Automatic Slideshow</h2>
< p>Change image every 10 seconds:</p>
// HTML markup...
The expected interval is 10 seconds, but it's only a couple of seconds. The next/previous slide buttons aren't functioning as expected either.