David1985 Posted October 2, 2023 Share Posted October 2, 2023 Hi everyone, I came across a horizontal scroll solution made by GSAP's Cassie that features a pausing effect on each horizontal scroll item. On initial page load this works perfectly! However when the window is resized, the effect is broken. If you look at the Codepen, there are two values that need be updated. container.offsetWidth, and the variable increment. From my understanding having 'invalidateOnRefresh: true' should update the container value, but it doesn't seem to be. The increment variable uses the container value as well so it is also not updating. Is anyone able to take a look and see what it would take to make it responsive? Hopefully it is a relatively easy fix. Thank you See the Pen NWeBwBL by dfranz1 (@dfranz1) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted October 2, 2023 Solution Share Posted October 2, 2023 Are you trying to do this?: See the Pen poqZYzL?editors=0010 by GreenSock (@GreenSock) on CodePen The problem was that the "increment" was only getting calculated when the page first loaded. You just need to make it dynamic. 1 Link to comment Share on other sites More sharing options...
David1985 Posted October 2, 2023 Author Share Posted October 2, 2023 Thanks Jack! My mediocre javascript skills didn't pick up on that. The increment value is now correctly renewing on window resize. Link to comment Share on other sites More sharing options...
GreenSock Posted October 2, 2023 Share Posted October 2, 2023 No problem. Happy to help. 🙌 Good luck with your project. 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