Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

102
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda