Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

284
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda