Jump to content
Search Community

End position based on the position of two elements

JE551 test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hi 👋

Thank you for your continued support!

Sorry if this is a stupid question, what I hope to achieve is pinning the element while keeping it vertically centred (assuming this means my start position should be 50% 50%/center center which I have in place in the pen) but I want the end point to be when the pinned elements bottom reaches the bottom of the list on the right. Any thoughts on how I could achieve this? 

-UPDATE-
I think I solved this myself, answer in reply below 

See the Pen rNrMLJN by JE551 (@JE551) on CodePen

Link to comment
Share on other sites

  • Solution

Nice job figuring it out. 🙌

 

You could do it many ways, actually. And you don't need to create a timeline every time you just want to create a ScrollTrigger. You can use ScrollTrigger.create(). And your demo was loading a very old version of GSAP/ScrollTrigger. I'd recommend shifting to the updated version and leverage the new gsap.matchMedia() instead of the old ScrollTrigger.matchMedia(). Here's a simplified, more modern fork: 

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

 

I hope that helps.

  • Like 1
Link to comment
Share on other sites

Yikes I'm so many versions behind 😅 appreciate the heads up and the ScrollTrigger.create() tip @GreenSock

I get a bit of anxiety posting things on forums as I find it a bit intimidating but I've had a really positive experience here and I sincerely appreciate the time you and others put into supporting me. THANK YOU!

  • Like 2
Link to comment
Share on other sites

6 hours ago, JE551 said:

I get a bit of anxiety posting things on forums as I find it a bit intimidating but I've had a really positive experience here and I sincerely appreciate the time you and others put into supporting me. THANK YOU!

I totally get that. It's always a little nerve-wracking to post in forums anywhere. The fear of looking dumb (for me at least) is real. And then you've got those snarky snobs that can be insulting...but we don't tolerate any of that garbage around here. We work hard to cultivate a positive vibe. 

 

I see you've chimed in on another thread too. We love when people in this community help others. In fact, I'd argue it's the BEST way to up your skills - just try helping others. So thanks for stepping up. 👍

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