Jump to content
Search Community

Scrolltrigger kill after completed

krisxtina test
Moderator Tag

Recommended Posts

Hello. This is scroll trigger demo, Image comparison on scroll. I don`t understand how I can stop this image animation after it is completed. Can you please help me? If I use tl.kill() or tl.scrollTrigger.kill() - something strange happens. Or, my screen continue be in position fixed, I don`t want it. 

 

 

 

See the Pen oNjgEjm by GreenSock (@GreenSock) on CodePen

Link to comment
Share on other sites

I'm not entirely sure that is possible with ScrollTrigger. When you make a pin, you have a bunch of extra scrolls space added onto the page for the duration of that pin. Removing that space would make the page jump. Hopefully someone with more experience can chime in.

Link to comment
Share on other sites

Hey there @krisxtina

 

You might want to have a look at this thread - it links to some other threads with some suggestions on how to handle that.

 

 

 

 

The first one linked in there probably has the most complete piece of code:

 

 

 

 

... I just quickly threw it into that demo pen you posted and this is the result. Does that look like what you are after ?

 

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

 

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