Jump to content
Search Community

scrollTrigger

Flying Kid test
Moderator Tag

Recommended Posts

If you open the console on your web page, you'll see that there are a ton of errors being thrown. Uncaught TypeError: a.target.className.indexOf is not a function
 

That's not anything related to GSAP. 

 

The problem with your CodePen is that you nested the scrollTrigger inside the motionPath object. 

//BAD
gsap.to("#bee", {
  duration:2,
  motionPath: {
    path:"#cpath",
    align:"#cpath",
    alignOrigin:[0.5, 0.5],
    autoRotate:true,
    scrollTrigger: "#bee"
  }
});

// GOOD
gsap.to("#bee", { 
  duration:2,
  scrollTrigger: "#bee"
  motionPath: {
    path:"#cpath",
    align:"#cpath",
    alignOrigin:[0.5, 0.5],
    autoRotate:true
  }
});

Also, your code is just telling it to play your animation when "#bee" enters the viewport, but you've got it at the top of your page so that basically means it's always gonna play right away (I see no purpose in even adding a scrollTrigger like that). 

  • Like 2
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...