When infiniteScrollContainer is empty, the infiniteScrollDistance calculate wrong.
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."
The Actual Behavior is "add the next 20 items when scroll to almost 70% position"
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
);
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)
+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.
How did you fixed it?
Replaced const scrolledUntilNow = container.height + container.scrolled; by const scrolledUntilNow = container.scrolled; in the shouldFireScrollEvent function here:
https://github.com/orizens/ngx-infinite-scroll/blob/master/src/services/scroll-resolver.ts
Seems to work for me so far but not sure it's the perfect fix.
Can this fix be ported to version that supports angular 4? We are using version 0.8.4 and we need this fix.
Most helpful comment
+1, I seem to have the same problem with scrollDown. I am setting
infiniteScrollDistanceto 0 but the onScroll event is triggered before I reach the bottom of the container.Removing the height from the addition in
shouldFireScrollEventlooks like it fixes it.