Share Posted October 5, 2021 Hi there, This might be an edge case, but I'm trying to create a position:sticky element inside a scrolltrigger. It seems to incorrectly stick the position the "Sticky Bar" div as the parent uses a translate to pin the scrollTrigger (which affects the position of the sticky bar). Are there any workarounds for this type of setup? See the Pen BaZgWOj by grafiknz (@grafiknz) on CodePen 1 Link to comment Share on other sites More sharing options...
Share Posted October 6, 2021 It is definitely an edge case where position: sticky just won't work but you could use ScrollTrigger to create a similar effect (if I understand your goal correctly): See the Pen gORNVoN?editors=0010 by GreenSock (@GreenSock) on CodePen Does that help? 1 2 Link to comment Share on other sites More sharing options...
Author Share Posted October 6, 2021 Thanks, great! that solves it (had no idea you could nest scrolltriggers!) could I also use pinReparent ? Link to comment Share on other sites More sharing options...
Share Posted October 6, 2021 Why would you want to use pinReparent? It's only intended as a last resort in some very tricky situations, but I'd recommend avoiding it if you can because it's expensive and tricky. Link to comment Share on other sites More sharing options...
Author Share Posted October 6, 2021 Great, thanks Link to comment Share on other sites More sharing options...
Share Posted October 13, 2021 @GreenSock I am trying to the same thing, but without any content between the sticky and the curtain. I've adjusted your example here, See the Pen YzxXZgx by joris-rotteveel (@joris-rotteveel) on CodePen . Unfortunately, the black box scrolls down when scrolling before pinning. Is this possible you think? Link to comment Share on other sites More sharing options...
Share Posted October 13, 2021 You really can't have two nested pinned elements simultaneously. In other words, you're trying to pin an element whose ancestor is also simultaneously pinned. You could just tell that nested element's ScrollTrigger to start when the ancestor's is finished. In this case, it's simple because we can use the .previous() method to grab that ScrollTrigger and use its end: start: self => self.previous().end See the Pen GRvJezp?editors=0010 by GreenSock (@GreenSock) on CodePen Is that what you're looking for? 2 Link to comment Share on other sites More sharing options...
Share Posted October 13, 2021 @GreenSock So the order of creation would be important here. This is definitely a great new way of dealing with it! Will look into the docs and dig a bit deeper. Thanks a million for your help. This is why I have absolutely no issues with paying for a subscription to GSAP, great product and awesome forum! 1 1 Link to comment Share on other sites More sharing options...
Share Posted May 12 @GreenSock Thank you for your answers. I have two fixed menus on a page, and the top menu should be hidden when you scroll up. Is it possible to make the position of the bottom fixed menu when scrolling upwards not start from zero, but depend on the height of the top menu and when scrolling upwards both the top and bottom menu will be visible. See the Pen dydXamm?editors=1111 by Wikt (@Wikt) on CodePen Link to comment Share on other sites More sharing options...
Share Posted May 12 I read your post a few times and I don't really understand what you're asking. We love helping with GSAP-related questions, but unfortunately we just don't have the resources to provide free general consulting, logic troubleshooting, or "here are my list of requirements, please show me how to build it" tutorials. Of course anyone else is welcome to post an answer if they'd like - we just want to manage expectations. You can post in the "Jobs & Freelance" forum for paid consulting, or contact us directly. Lastly, it's typically best to create a new thread instead of piggy-backing on very old ones. 1 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