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

208
Vistas
Text is shaking after using useEffect in Next JS

I want to build my client website like ssk.com and I tried to change the JQuery code from this jsfiddle.net/LmkwxkfL to the code. but seems I failed to translate the code.

Result: text is shaking after scrolling

This is my code:

const [scroll, setScroll] = useState(0);

useEffect(() => {
    window.addEventListener("scroll", handleScroll);
    return () => {
        window.removeEventListener("scroll", handleScroll);
    };
});

function handleScroll() {
    setScroll(
        window.scrollY ||
        window.scrollTop ||
        document.getElementsByTagName("html")[0].scrollTop,
        document.documentElement.style.setProperty("--scroll-var", scroll + "px")
    );
}

I don't know what is missing, but it makes all my text shaky after rendering it and starts after scrolling the page.

So sorry I'm a newbie here.

about 4 years ago · Juan Pablo Isaza
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