infiniteScrollDistance calculate wrong
See original GitHub issueWhen 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:
- Created 5 years ago
- Comments:5
Top GitHub Comments
+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.Hi,
I have same problem now with scrollDown. Did #282 correct only scrollUp ?
In my case :
Consequently the event scrolled (with shouldFireEvent=true) is fire nearly immediatly after first scroll (remaining is negative)