Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
My image carousel breaks strangely between each slide

So I have an image carousel that for some reason I cannot explain is breaking strangely between each slide. What I mean by breaking is that each slide (image) appears for about one second then goes white before showing the next image for a second and that loop continues. Any help is appreciated.

The CSS

            * {
                box-sizing: border-box;
            }

            body {
                font-family: Verdana, sans-serif;
                margin: 0
            }

            .mySlides {
                display: none
            }
            img {
                vertical-align: middle;
            }
            .slideshow-container {
                max-width: 1000px;
                position: relative;
                margin: auto;
            }
            
            /* Fading animation */
            .fade {
                -webkit-animation-name: fade;
                -webkit-animation-duration: 1s;
                animation-name: fade;
                animation-duration: 1s;
            }
            @-webkit-keyframes fade {
                from {
                opacity: .4
                }
                to {
                opacity: 1
                }
            }
            @keyframes fade {
                from {
                opacity: .4
                }
                to {
                opacity: 1
                }
            }

The HTML

        <div class="slideshow-container">
        <div class="mySlides fade">
            <img src="img/homebanner1.png" style="width:100%">
        </div>
        <div class="mySlides fade">
            <img src="img/homebanner2.png" style="width:100%">
        </div>
        <div class="mySlides fade">
            <img src="img/homebanner1.png" style="width:100%">
        </div>
        </div>

The Javascript

            var slideIndex = 0;
            showSlides();
            function showSlides() {
                var i;
                var 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, 10000); // Change image every 10 seconds
            }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Issue was setTimeout(showSlides, 10000); // Change image every 10 seconds was different interval of time (10 seconds) but fade was set to every 1 second as well as @-webkit-keyframes fadeOut was set to opacity .4 to 1 and not 0.4 to 1

.fade {
    -webkit-animation-name: fade;
    -webkit-animation-duration: 1s;
    animation-name: fade;
    animation-duration: 1s;
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!