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

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

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 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