Jump to content
Search Community

How to make previous element on scroll trigger not moving

dingkai031 test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hello lovely communities of GSAP, I'm new with GSAP. I need help, 

As you can see the previous element in the demo, it is moving on scroll. What I expect is the previous element stay as the "scroll trigger" triggered and not getting out of view port. By the previous element, I mean the one with background red and also the animated element height need to stay the same.

 

Is this normal? or is there any method that I need to adjust? 

Thank you

See the Pen vYPVLbx by dingkai031 (@dingkai031) on CodePen

Link to comment
Share on other sites

  • Solution

Instead of setting pin: true, you can also set pin to an element, if we set it to the element that encloses everything you want to pin eg the .container it works as you want. My advise check the docs and just read it once, sounds boring... but you'll be surprised how much it explains that you didn't even know was possible  https://gsap.com/docs/v3/Plugins/ScrollTrigger/. Hope it helps and happy tweening! 

 

See the Pen mdozPrp by mvaneijgen (@mvaneijgen) on CodePen

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