Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7806505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:33:28+00:00 2026-06-02T02:33:28+00:00

I have an infinity scroll style page I’m working on, (for an example of

  • 0

I have an infinity scroll style page I’m working on, (for an example of infinity scroll, click here and scroll down) which runs a function called update() every time the user scrolls, among other things.

I could use setInterval instead and check every x millis, however with a timeout that calls itself, the page responds quicker and more reliably.

Basically, update() adds some content to the page, then, if that content isn’t enough to let you scroll down more, sets a timeout to call update() again. If you only scrolled one pixel, this would be fine, but of course, when you scroll it sends tens or hundreds of scroll events. This becomes a problem because there will be tens (or hundreds) of timeouts running at once. Having too many timeouts kills the consistent animation of adding new content I was going for.

So I wanted to check for if a timeout was already waiting to execute using the ID I had, however there doesn’t seem to be a function for this is JavaScript. Is there a way to check whether a timeout ID has executed yet or not? If not, are there alternatives? I have JQuery.

…Or should I just make an interval and sacrifice the responsiveness?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:33:30+00:00Added an answer on June 2, 2026 at 2:33 am

    When the function fires, clear the interval and set the variable you’re holding the initial in to null. Then check for a null value. If you’re doing a bunch of these, you could store them in an array by the id you have.

    eg:

    var intervals = [];
    
    if(intervals[id] != null){
        intervals[id] = setTimeout(some_func, 1000);
    
        var some_func = function(){
            // do stuff
            clearTimeout(intervals[id]);
            intervals[id] = null;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a timer to refresh the page, and it's working: updateCountdown = function()
Possible Duplicate: UIScrollView. Any thoughts on implementing “infinite” scroll/zoom? I have a UIScroll which
I have a infinite scroll script which works for my tumblr . It's loading
I have a page with infinite scroll. It calculates the difference between the end
I have infinite gallery based on this example : http://blog.blundell-apps.com/infinite-scrolling-gallery/ , It runs nicely,
I have set up infinite scroll on a website I am building here: http://richardgordoncook.com/fg/
I have a loop of posts that I use infinite scroll to paginate. I
I have a div tag which I populate dynamically. The problem is that in
I would like to have my user scroll inside a CPXYGraph. I have a
I have a set of 100 rows, pretty similar to values which can be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.