Jump to content
GreenSock

Krischomat

GSAP Vue.js and scrollTrigger

Recommended Posts

Hey! I am just getting into gsap and trying to implement it in a Vue3 Project. But atm the scrollTrigger does not work for me. I am doing this

onMounted(() => {
  gsap.to(".events", { scrollTrigger: ".events", x: 100, duration: 3 });
});

and the scrollTrigger does not do anything. So the animation starts when the page is loaded no matter if the element is in the viewport or not.

Any Ideas?

Link to comment
Share on other sites

Ahh got it...

import ScrollTrigger from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×