Jump to content
Search Community

gsap.registerPlugin() issues?

DeveloperJones test
Moderator Tag

Recommended Posts

Hi folks, 

I am working on a project and I am getting this issue (see screenshot) but my code is like this:

 


//I've commented this out as I was trying to solve it myself.
// gsap.registerPlugin(ScrollTrigger);


gsap.to(".firstBoxLeft", {
  scrollTrigger: ".st1", 
  y: -100,
  toggleClass: {
      targets: ".firstBoxLeft", 
      className: "testClass"
  },
  pin: true,
  start: "bottom center",
  toggleActions: "play complete play reset",
  scrub: 1, // smooth scrubbing, takes 1 second to "catch up" to the scrollbar
  markers: {startColor: "red", endColor: "red", fontSize: "18px", fontWeight: "bold", indent: 20},
  snap: {
      snapTo: 'flexWrapper',
      duration: {min: 0.2, max: 3}, // the snap animation should be at least 0.2 seconds, but no more than 3 seconds (determined by velocity)
        delay: 0.2, // wait 0.2 seconds from the last scroll event before doing the snapping
        ease: "power1.inOut" // the ease of the snap animation ("power3" by default)
  }
});

 

I've read the docs but do not get what I am doing wrong here.

 

Thank you for the help!

 

 

Screenshot 2020-06-15 at 08.33.14.png

Link to comment
Share on other sites

Please make sure you are using the latest version, 3.3.3, and you are actually loading ScrollTrigger. If you still need help, please provide a reduced test case so we can see what is going on. We would love to help. 
 

and yes, you must register ScrollTrigger. 

  • Like 2
Link to comment
Share on other sites

Most likely your load order is wrong. Make sure that your custom scripts are loaded after GSAP and ScrollTrigger.

 

And did you make sure the ScrollTrigger properties are inside of an object like Jack instructed? 

 

Again, please provide a reduced test case if you're still having issues.

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