I use the following code to check if I can fetch the next page for my infinite scroll feature.
let bottomOfWindow = document.documentElement.scrollTop + window.innerHeight === document.documentElement.offsetHeight;
if (bottomOfWindow) {
// some logic
}
This works well on desktop browsers but doesn't work on mobile browsers. On debugging, I noticed that the condition doesn't meet because of these values,
document.documentElement.scrollTop;
6580.72705078125
window.innerHeight
1851
document.documentElement.offsetHeight
8432
My questions,