Jump to content
Search Community

Moved pinned element before it pins causes jump

rpsstudios test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

I'm working on an animation where we have a 100vh height block that gets pinned and then we have a gradient bg that grows while it gets pinned. Since the current element is full-height I want to bring the next pinned section up underneath it before it gets pinned. I can get the first pin to work, and I can hug the next section up to it with a simple y animation. The catch is that this causes the next pinned element to jump once it hits the spot it was originally supposed to pin at. Is there a different way to handle this, or maybe I'm just asking too much.

See the Pen gOBbmKg by rpsstudios (@rpsstudios) on CodePen

Link to comment
Share on other sites

  • Solution

Yeah, the problem is that you're animating the very element that you're attempting to pin, so it throws things off. 

 

I'm literally in a car driving down the highway right now so I have very limited time to dig into this, but usually in a situation like this it's best to just create a container that you pin instead so that you're not contaminating things: 

See the Pen qBJEMKe?editors=1010 by GreenSock (@GreenSock) on CodePen

 

I hope that helps.

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