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

161
Visualizações
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
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