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.

infiniteScrollDistance calculate wrong

See original GitHub issue

When infiniteScrollContainer is empty, the infiniteScrollDistance calculate wrong.

Expected Behavior

In the demo link “https://plnkr.co/edit/DrEDetYnZkFxR7OWWrxS?p=preview”,

The Expected Behavior is “should add the next 20 items when scroll to 90% position.”

Actual Behavior

The Actual Behavior is “add the next 20 items when scroll to almost 70% position”

Possible Solution

It seems that the scrolledUntilNow add height twice.

shouldFireScrollEvent in ngx-infinite-scroll/src/services/scroll-resolver.ts const scrolledUntilNow = container.height + container.scrolled;

calculatePointsForWindow in ngx-infinite-scroll/src/services/position-resolver.ts // scrolled until now / current y point const scrolled = height + getElementPageYOffset( getDocumentElement(isWindow, container), axis, isWindow );

Your Environment

  • Version used: 0.8.4
  • Browser Name and version: Chrome
  • (Optional) Operating System and version (desktop or mobile): Win10 desktop

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
julambcommented, Jan 28, 2019

+1, I seem to have the same problem with scrollDown. I am setting infiniteScrollDistance to 0 but the onScroll event is triggered before I reach the bottom of the container.

Removing the height from the addition in shouldFireScrollEvent looks like it fixes it.

1reaction
Ballrockcommented, Oct 19, 2018

Hi,

I have same problem now with scrollDown. Did #282 correct only scrollUp ?

In my case :

  • infiniteScrollContainer - empty
  • scrolledUntilNow add 2 time height (calculatePointForWindow AND shouldFireScrollEvent)

Consequently the event scrolled (with shouldFireEvent=true) is fire nearly immediatly after first scroll (remaining is negative)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ngx infinite scrolling - Template parse errors: Can't bind to ...
And the error I get is that infiniteScrollDistance isn't a known property of 'div', and can't bind to it . What I am...
Read more >
ngInfiniteScroll - Documentation - Infinite Scrolling for AngularJS
Measured in multiples of the window height; for example, if the browser window is 1000 pixels tall and infinite-scroll-distance is set to 2...
Read more >
ngx-infinite-scroll - Angular - npm
fromRoot is used to determine whether the scroll container has to be searched within the whole document ( [fromRoot]="true" ) or just inside...
Read more >
Implementation Of Ngx Infinite Scroller Using Angular ...
In this article, we will integrate an infinite scroller. In this example, when we scroll down only a few items, it will show...
Read more >
ng-zorro/ng-zorro-antd - Gitter
Error : Template parse errors: Can't bind to 'infiniteScrollDistance' since it ... Hi all, i just install ng-zorro to my project, i can't...
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