Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

207
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!