Topic: Infinite Scroll does not trigger
smoehrle free asked 1 year ago
Expected behavior
Infinite scroll triggers complete.mdb.infiniteScroll correctly.
Actual behavior
Event is not triggered. This is due to the condition()
function in infinite-scroll.js. Currently the function contains the following lines:
if (this._element === window) {
return window.scrollY + window.innerHeight === document.documentElement.scrollHeight;
}
In my case if I scroll to the bottom, I have the following values:
window.scrollY = 1745.6666259765625
window.innerHeight = 995
window.scrollY + window.innerHeight = 2740.6666259765625
document.documentElement.scrollHeight = 2741;
And because of that the event is not triggered properly.
Suggested fix:
return Math.abs(window.scrollY + window.innerHeight - document.documentElement.scrollHeight) < 1;
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 6.2.0
- Device: Desktop
- Browser: Firefox
- OS: Ubuntu
- Provided sample code: Yes
- Provided link: No