question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Takes a long time for onScroll to fire

See original GitHub issue

I have

<div class="search-results" 
    infiniteScroll 
    [infiniteScrollDistance]="2"
    [infiniteScrollThrottle]="500" 
    (scrolled)="onScroll()">
</div>

When I scroll to the bottom, it somtimes takes 4 seconds for onScroll to fire.

I’ve tried all kinds of values for infiniteScrollDistance. With a high value, it works initially, but after scrolling for a while, the problem is back.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:5
  • Comments:28 (19 by maintainers)

github_iconTop GitHub Comments

4reactions
nupacommented, Jan 8, 2018

I experienced this issue also in Chrome (OS X), but not in other browsers. Happens still with new 0.8.1. It seems that the problematic part is the sampleTime() as adrienverge found out above. I think the root cause might be this: https://bugs.chromium.org/p/chromium/issues/detail?id=661155

sampleTime() uses timeout and while scrolling - especially rapidly with track pad - the events won’t arrive. After the scrolling is stopped, it takes couple of seconds and everything is working again.

I wonder if the semantics of the scroll throttle option could be changed a bit, so that 0 would leave the sampleTime() part out totally?

3reactions
adrienvergecommented, Feb 10, 2018

I have opened https://github.com/orizens/ngx-infinite-scroll/pull/235, it solves the problem for me when using [infiniteScrollThrottle]="0".

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scroll event firing too many times. I only want it to fire a ...
One way to solve this problem is to define a time interval and only process a scroll event once within that time interval....
Read more >
Quick Tip: How to Throttle Scroll Events - SitePoint
Given the size of the page, it takes many seconds to scroll through content. This enables throttling to fire the event only once...
Read more >
How to develop high performance onScroll event?
The onscroll event trigger interval time is around 10~20ms when we scrolling the mouse wheel. However, in most cases we don't need the...
Read more >
Scroll Events and Intersection Observer - Beginner JavaScript
In this video we will learn about scroll events. A scroll event is when someone goes ahead and scrolls on the page or...
Read more >
.scroll() | jQuery API Documentation
Now when the user scrolls the text up or down, one or more messages are appended to <div id="log"></div> : Handler for .scroll()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found