Share Posted April 23, 2021 Hi everyone, Just wondering what the best practice is in this case. I'd like to always pin the container divs in this CodePen example to prevent them from un-pinning at each end of the scroll range. Currently they'll un-pin as expected and the tween will then scroll up or down as it finishes up. What's the best way to keep these divs in place so the next tween can start while the previous one finishes up, without any of them moving vertically? I'm sure I can figure out a solution but I'd like to know if there's a simple technique I might be overlooking. Thanks in advance and happy tweening! Brian See the Pen rNjomLx by BrianCross (@BrianCross) on CodePen Link to comment Share on other sites More sharing options...
Share Posted April 23, 2021 Pretty sure that would involve some sort of scroll jacking. What you're basically asking for is a way to pause scrolling, which isn't possible unless you hijack the scroll. 1 Link to comment Share on other sites More sharing options...
Solution Solution Share Posted April 23, 2021 Yep, here's a fork that uses ScrollTrigger for smooth-scrolling the whole thing. You've gotta add 2 wrapper <div> elements, use the smoothScroll() helper function, and apply the scrub value to the smoothScrolling and set scrub: true on your timeline's ScrollTrigger: See the Pen yLgGzoN?editors=0010 by GreenSock (@GreenSock) on CodePen 2 Link to comment Share on other sites More sharing options...
Author Share Posted April 24, 2021 @OSUblake @GreenSock thanks so much guys. Yeah I think this is a much more elegant solution than what I was thinking. So much learning going on here and it's much appreciated. 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