I'm facing an issue with adding a slideshow to the header of my website. When the page initially loads, the slides do not appear; instead, I see the dots and arrows positioned higher than they should be. However, when I click on a dot or the "next page" arrow, the images display correctly until I reach the end of the slides. At that point, the images disappear again, and the arrows and dots shift position. As a coding newbie who has been struggling for two days, I apologize for raising what may seem like a simple problem. I've searched for similar questions here but haven't found a solution yet, so any help would be greatly appreciated!
<script>
var slideIndex = 1;
showSlides(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function currentSlide(n) {
showSlides(slideIndex = n);
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
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>
...