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

295
Visualizações
skew text on scroll, how to target class instead of section

Found this scrolling effect on Codepen. Is it possible to adjust the code so that I can target lines of text by class '.hometext', rather than targeting the entire section '#work' as it currently does?

const section = document.querySelector("#work");
let currentPixel = window.pageYOffset

//looper keeps running and keeps track of where the new pixel is
const looper = function () {
  const newPixel = window.pageYOffset;
  const diff = newPixel - currentPixel
  const speed = diff * 0.05;
  
  section.style.transform = "skewY(" + speed + "deg)"
  
  
  currentPixel = newPixel;
  
  requestAnimationFrame(looper)
}

looper();
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

document.querySelectorAll => elements array then for of elements

const section = document.querySelectorAll(".hometext");
let currentPixel = window.pageYOffset

//looper keeps running and keeps track of where the new pixel is
const looper = function () {
   const newPixel = window.pageYOffset;
   const diff = newPixel - currentPixel
    const speed = diff * 0.35;

    //for of elements
    for(let el of section){
        el.style.transform = "skewY(" + speed + "deg)"
    }

    currentPixel = newPixel;

    requestAnimationFrame(looper)
}

looper();
about 4 years ago · Juan Pablo Isaza Relatório
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