I've got a slideshow on my webpage. It switches from images using the following script:
setInterval(function() {
$('#slideshow > div:first')
.fadeOut(0)
.next()
.fadeIn(1000)
.end()
.appendTo('#slideshow');
}, 7000);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="slideshow" name="slideshow" class="slideshow">
<div>
<img src='{ROOT}img/Camerashop24/slide1.jpg' alt="slide-1" class="slide">
</div>
<div>
<img src='{ROOT}img/Camerashop24/slide2.jpg' alt="slide-2" class="slide">
</div>
<div>
<img src='{ROOT}img/Camerashop24/slide3.jpg' alt="slide-3" class="slide">
</div>
<div>
<img src='{ROOT}img/Camerashop24/slide4.jpg' alt="slide-4" class="slide">
</div>
</div>
However, when the slides are changing, the slideshow is above the dropdown menu until it completely loaded. It then goes behind the menu again. The menu has a z-index of 100, the slideshow has a z-index of 10. If needed, I can give the css of the menu, but that's quite a long list.
Why is the slideshow above the menu when switching?
</div>
Using this code the slides work fine ...
var myIndex = 0;
carousel();
function carousel() {
var i;
var x = document.getElementsByClassName("mySlides");
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
myIndex++;
if (myIndex > x.length) {myIndex = 1}
x[myIndex-1].style.display = "block";
setTimeout(carousel, 2000); // Change image every 2 seconds
}
<div id="slideshow" name="slideshow" class="slideshow">
<img class="mySlides" src='{ROOT}img/Camerashop24/slide1.jpg' alt="slide-1" class="slide">
<img class="mySlides" src='{ROOT}img/Camerashop24/slide2.jpg' alt="slide-2" class="slide">
<img class="mySlides" src='{ROOT}img/Camerashop24/slide3.jpg' alt="slide-3" class="slide">
<img class="mySlides" src='{ROOT}img/Camerashop24/slide4.jpg' alt="slide-4" class="slide">
</div>
</div>