Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

179
Views
Infinite scroll for mobile screens of my web application doesn't work

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,

  1. Why does this happen on mobile screens alone?
  2. If I change the condition to >= document.documentElement.offsetHeight * 0.90, will there be a scenario where even this condition will not satisfy?
  3. Is there a more elegant solution?
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!