Jump to content
GreenSock

Zilli

GSAP ScrollTrigger not defined. Using gsap.min.js

Go to solution Solved by mvaneijgen,

Recommended Posts

Hi, 
I have been using gsap tweens in my project using the full member minified version of Gsap and it has been working fine. I wanted to use the ScrollTrigger plug-in to time an animation on scroll and followed the tutorial on that but it already shows ScrollTrigger as unidentified. I know the minified version is working since i'm using it for other elements.

 

For testing purposes I added the register and the tween in a separate js file and linked it in the html file.

 

I register the plugin at the beginning of my script file as such:
 

   /* gsap plugins */
    gsap.registerPlugin(ScrollTrigger); 

and at the end of the document adding the gsap tween:

 

gsap.from("#section-2", { ScrollTrigger: "#section-2" rotation: 15, y: 15, duration: 0.5 }),

 

I thought that the ScrollTrigger plug-in was added in the full version? 

Thanks

Link to comment
Share on other sites

15 minutes ago, mvaneijgen said:

ScrollTrigger is a different file you need to load.

 

Take a look at https://greensock.com/docs/v3/Installation to help you install all the correct files for what you want to use 

Ah okay. Ik thought that everything was included. Thanks so much for clarifying! 

Link to comment
Share on other sites

1 hour ago, Zilli said:

gsap.from("#section-2", { ScrollTrigger: "#section-2" rotation: 15, y: 15, duration: 0.5 }),

Also, when using ScrollTrigger inside of a gsap object/timeline you want to camelCase it: gsap.from("#section-2", { scrollTrigger: "#section-2", rotation: 15, y: 15, duration: 0.5 }).  You're also missing a comma after your ScrollTrigger selector.

  • Like 3
Link to comment
Share on other sites

3 minutes ago, elegantseagulls said:

Also, when using ScrollTrigger inside of a gsap object/timeline you want to camelCase it: gsap.from("#section-2", { scrollTrigger: "#section-2", rotation: 15, y: 15, duration: 0.5 }).  You're also missing a comma after your ScrollTrigger selector.

Thank you for noticing. I indeed saw that and corrected it. It's working perfect now. 

  • 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.
×