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

133
Visualizações
How do I know (el.scrollHeight - el.scrollTop +1).toFixed(0) >= el.clientHeight.toFixed(0) its greater than by 1 than return true onScroll?

How do I know (target.scrollHeight - target.scrollTop +1).toFixed(0) >= target.clientHeight.toFixed(0) its greater than by only 1 than return true if its greater than 1 or any other value than it will return false.

I was trying this code...

const handleScroll = (event) => {
    const target = event.target;

    if ((target.scrollHeight - target.scrollTop).toFixed(0) === target.clientHeight.toFixed(0)) {

      let pageNo = page + 1;
      if (pageNo <= pageCount) {
        fetchSuppliers(data , pageNo);
        setPage(pageNo);
      }
    }
  };

This code is not working on some chrome cause in some big screen resolution the value is 201 === 200 so that time this code not working..**

so i have to try the greater than or equal condition but here has a fallback cause the left value will change on scroll like 800 >= 200 its giving true but i want when the value 201 or 202 >= 200 then it should return true otherwise return false

Help me on this regards Thank you all

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