Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

134
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!