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

141
Views
How to add a timer onto a page scroll

I'm working on building an infinite page-scroll, at least until it reaches the last page. However, it scrolls way to quickly and overloads my web-browser. I wanted to know how I can implement a time-lag on each scroll, something like 1-2 seconds between the scrolls.

Here's what I have developed so far:

var infScroll = setInterval(function () {
                                    var scrollingElement = (document.scrollingElement || document.body);
                                    scrollingElement.scrollTop = scrollingElement.scrollHeight;
                                }, 200);

It works and keeps scrolling down the page, however, how do I set a lag between each scroll?

I have tried updating it with a timer as the following:

function disableScroll() {
    // temporarily disable action
    scrollEnabled = false;

    // set a timer to enable again it 1 second from now
    setTimeout(function() {
        scrollEnabled = true;
    }, 8000);
}
var infScroll = setInterval(function () {
                var scrollingElement = (document.scrollingElement || document.body);
                scrollingElement.scrollTop = scrollingElement.scrollHeight; disableScroll()
                                }, 200);

However, the function won't stop the scroll at all for a few moments.

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