Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda