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

201
Visualizações
Can't check if the code is in the viewport

this is a code to detect if the section which I'm scrolling right now is in the viewport or not. This code actually works only if I get onto any section and refresh the page, it doesn't work continuously when I scroll through the page.

var secArr = document.querySelectorAll('section');


secArr.forEach(onscroll = function (element) {
    var bounding = element.getBoundingClientRect();

    if (bounding.top <= 350.00 && bounding.top >= -270.00) {
        if (!element.classList.contains("your-active-class")) {
            element.setAttribute("class", "your-active-class");
        }
    } 
    else {
        element.removeAttribute("class");
    }
});
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