Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda