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

214
Vistas
How to setInterval after clearInterval

I am working on a slideshow and I am trying to setInterval after it is being cleared using "clearInterval".

JavaScript

    var counter = 1;
let intervalRef = setInterval(function() {
  document.getElementById('radio' + counter).checked = true;
  counter++;
  if (counter > 4) {
    counter = 1;
  }
}, 5000);

document.querySelectorAll(".slide_bar").forEach(item => item.addEventListener("click", function(){
  clearInterval(intervalRef)
  console.log("Slide show stopped")
}))

https://jsfiddle.net/4ygwd579/

My goal is to make clearInterval lasts for 10 seconds then the slideshow plays the NEXT slide.

It would be appreciated if someone can post the new code.

about 4 years ago · Juan Pablo Isaza
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