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

136
Vistas
Stop/Pause clearTimeout until mouse hover out

guys.

So i've got this code that runs a loop on slides/tabs and they have a sort of dropdown interaction to show and hide text based on the current/active slide/tab.

What I want to add is a function where, if a user hovers over one of the tabs(.loop-tab-link) that the clearTimout pauses until the user hovers out of the div.

As you can see I tried adding a mouseover function but that only adds an additional 5 seconds to the Timeout.

  clearTimeout(tabTimeout);
  tabLoop();


function tabLoop() {
    tabTimeout = setTimeout(function() {
        var $next = $('.loop-tabs-menu').children('.current:first').next();

        if($next.length) {
            $next.click(); 
        } else {
            $('.loop-tab-link:first').click();
        }
    }, 5000);
}

 $('.loop-tab-link').on('mouseenter', function() {
    clearTimeout(tabTimeout);
    tabLoop();
    });
$('.loop-tab-link').click(function() {
    clearTimeout(tabTimeout);
    tabLoop();
    });
});
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Looks like you need exactly what you asked for

  clearTimeout(tabTimeout);
  tabLoop(5000);


function tabLoop(x) {
    tabTimeout = setTimeout(function() {
        var $next = $('.loop-tabs-menu').children('.current:first').next();

        if($next.length) {
            $next.click(); 
        } else {
            $('.loop-tab-link:first').click();
        }
    }, x);
}



 $('.loop-tab-link').mouseenter(function() {
    clearTimeout(tabTimeout);
    });

    $('.loop-tab-link').mouseleave(function(){
    tabLoop(1000);
});
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