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

130
Views
How to add a delay to after click

How to add a 2 second delay to the scrollbar.init after the #menu-toggle-close button is clicked?

    $('#menu-toggle-open').click(function () {
      scrollbar.destroy(document.body)
    })
    
    $('#menu-toggle-close').click(function () {
        scrollbar = Scrollbar.init(document.body, { delegateTo: document, alwaysShowTracks: true, speed: 0.7, damping:0.1, });


scrollbar.addListener(ScrollTrigger.update);
ScrollTrigger.defaults({ scroller: document.body });
})});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use setTimeout for this purpose. the second argument takes the delay in milliseconds, in this case it will be 2000 for 2 seconds.

    $('#menu-toggle-close').click(function () {
        setTimeout(() => {
            scrollbar = Scrollbar.init(document.body, { delegateTo: document, alwaysShowTracks: true, speed: 0.7, damping:0.1, });
            scrollbar.addListener(ScrollTrigger.update);
            ScrollTrigger.defaults({ scroller: document.body });
        }, 2000)
    })});
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!