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

143
Views
Problem with Infinity Scroll in mobile browser using Vanilla JavaScript

I've run into a bug/problem when i am trying to use infinity scroll in mobile browsers. I've made a project using vanilla js, and when the scrollbar goes to bottom it calls a function that fetching nextPage from an API( TMDB). Every time scrollbar touches bottom, it returns the next 20 items from the next page. So, in Desktop is all fine, but in mobile browsers, i am going to bottom and nothing happened. I think there is a problem with mobile browser topbar, but how i can fix it? Here is my code:

window.addEventListener("scroll", () => {
  const { scrollTop, scrollHeight, clientHeight } = document.documentElement;

  if (scrollTop + clientHeight >= scrollHeight) {
    showLoading();
  }
}); 

I would be appreciate if anyone can give me a hint about it. Thank you!

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!