JE551 Posted January 4, 2023 Share Posted January 4, 2023 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 More sharing options...
JE551 Posted January 4, 2023 Author Share Posted January 4, 2023 I think I solved this with... end: () => "100% 50%+=" + document.querySelector("#img-cat").offsetHeight / 2 Link to comment Share on other sites More sharing options...
Solution GreenSock Posted January 4, 2023 Solution Share Posted January 4, 2023 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. 1 Link to comment Share on other sites More sharing options...
JE551 Posted January 4, 2023 Author Share Posted January 4, 2023 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! 2 Link to comment Share on other sites More sharing options...
GreenSock Posted January 4, 2023 Share Posted January 4, 2023 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. 👍 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now