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

162
Views
Using javascript / gsap in react

So I have a question on how to use this little bit of script in my react app.

  const tl = gsap.timeline({ defaults: { ease: "power1.out" } });

  tl.to("body", { overflow: "hidden" });
  tl.to(".text", { x: "0%", duration: 0.5 });
  tl.fromTo(
    ".textleft, .textright",
    { opacity: 0 },
    { x: "0%", opacity: 1, duration: 1.5 }
  );
  tl.to(".sliderasd", { y: "-100%", duration: 1.5, delay: 0.5 });
  tl.to(".intro", { y: "-100%", duration: 1 }, "-=1");
  tl.to(".newsletter-form", { y: "0%", duration: 1 }, "-=1");
  tl.to("body", { overflow: "", scrollTrigger: "body" });
  tl.fromTo(
    ".slideshow-container",
    { opacity: 0 },
    { opacity: 1, duration: 3 }
  );

It should be an intro animation to my website. I try to save it as a component and then export it to App.jsx but it doesnt seem to work. Of course i have imported GSAP.

Also when I put the code inside App function, it works only for one time and when i refresh the page nothing happens. The classes in the code are in different components.

I also have the same problem with slider I have created which seems to be working in non-react app.

Basiclly I would like to find out how can I use any JS script in my react app

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!