SetTimeout inside a for loop
问题 I'm trying to write a script that changes the z-index of 3 images. Basically the script should target the current image and apply a higher z-index on the next image, like a sort of carousel but with a z-index rather then active class. The challenge is to set the z-index after a specific interval. The problem is that the first image is displayed and then the last one. This is my code: Html: <div class="changingimages"> <img src="#" data-time="3000" width="100%" class="alternateimage