Jump to content
Search Community

Getting a timeline to launch using ScrollTrigger, then reset and replay if scrolled back into

sam_tween_journeyer test
Moderator Tag

Recommended Posts

I've fiddled with this for a while, to the point of dumbness, I'm now redesignated 'grouchTrigger' from an id to a class to see if I can get my desired behaviour.

 

So far as I can tell the ScrollTrigger isn't triggering, the animation just plays immediately, possibly after the Triggers delay.

 

What's the correct way of achieving this?

 

Thanks

Sam

See the Pen oNodBGa by Sam654657987 (@Sam654657987) on CodePen

Link to comment
Share on other sites

Hello Sam.

 

First and foremost you'll want to load GSAP and ScrollTrigger, which you seem to have forgotten in your codepen demo.

 

Then you'll also need some scrollable space to begin with - I added some spacers to your demo.

 

When using ScrollTrigger as an object inside a tween/timeline, there it is supposed to be scrollTrigger in camelCase - you wrote ScrollTrigger.

 

Also, there is no need for setting once to false if you don't want it to trigger once only, as that is the default. And if you want to use once: true, you'll want to put it inside the scrollTrigger object, not on the timeline itself.

 

I hope that helps a bit.

 

See the Pen ExbLZQE by akapowl (@akapowl) on CodePen

 

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