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

110
Views
Show each div in HTMl collection for 1 sec then hide it

I have 10 divs inside a container.

I want to show 1 div for 1 second the remove it and show notthing for 1 sec then show next div for 1 sec and so on.

Right now I started with all divs having a class of hide which is display:none in CSS.

And in JS this is what I have for the moment. everything works but the break at 1 sec before next div I dont know how to add:

function showOneAtTheTime() {  
    game5Intro.classList.add('hide')
    let letter = 0;
    myShapes(); // function which creating the 10 divs
    let timeInter = setInterval(function () {
        let alles = content.querySelectorAll("div")[letter]
        alles.classList.remove('hide');
        setTimeout(function () {
        alles.classList.add('hide');
    }, 1000)
    letter++;
    if (letter === 9) {
        clearInterval(timeInter);
        timeInter = null;
    }
   }, 1000);

}

}

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

NVM I just added 2 second to the interval instead of 1 and that solved my problem

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!