Jeza95 Posted March 31, 2022 Share Posted March 31, 2022 Im currently using the slideshow/carousel code with automatic slide JS, but I'm having issues with the timing of the slides. The issue is when I set the timing to 4000ms, the intervals are showing one slide, then 4000ms of nothing, then the next slide. Would anyone be able to assist? Here's the code I'm using: <!-- Slideshow container --> <div class="slideshow-container"> <!-- Full-width images with number and caption text --> <div class="mySlides fade"> <a href="https://bhl.co.uk/heating-plumbing/air-conditioning-ventilation.html"> <img src="{{media url="wysiwyg/AC_banner_1.png"}}" alt="" /> </a> </div> <div class="mySlides fade"> <a href="https://bhl.co.uk/outdoor-gardening/garden-chemicals/seeds-bulbs.html"> <img src="{{media url="wysiwyg/Bird_Seeds_1.png"}}" alt="" /> </a> </div> <div class="mySlides fade"> <a href="https://bhl.co.uk/outdoor-gardening/garden-tools.html"> <img src="{{media url="wysiwyg/garden_tools_banner_1.png"}}" alt="" /> </a> </div> <div class="mySlides fade"> <a href="https://bhl.co.uk/outdoor-gardening/garden-watering.html"> <img src="{{media url="wysiwyg/Garden_Watering_Banner_1.png"}}" alt="" /> </a> </div> </div> <br> <!-- The dots/circles --> <div style="text-align:center"> </div> <script> let slideIndex = 0; showSlides(); function showSlides() { let i; let slides = document.getElementsByClassName("mySlides"); for (i = 0; i < slides.length; i++) { slides[i].style.display = "none"; } slideIndex++; if (slideIndex > slides.length) {slideIndex = 1} slides[slideIndex-1].style.display = "block"; setTimeout(showSlides, 3500); // Change image every 4 seconds } </script> 1 Link to comment Share on other sites More sharing options...
Ingolme Posted March 31, 2022 Share Posted March 31, 2022 There is not enough information here to solve the problem, so I have to make some guesses. It's possible that the fade class has an animation which makes the slide fade out. Try removing the fade class from the slides. If you want a fading effect, the Javascript code needs to have some control over it. Link to comment Share on other sites More sharing options...
Jeza95 Posted April 1, 2022 Author Share Posted April 1, 2022 Amazing, thanks Ingolme! I removed the fade and it's now working as I need it to! Thanks again Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now