Marco2309 Posted February 6, 2022 Share Posted February 6, 2022 I am new to gsap and I don't speak English but I will try to translate my problem If you scroll it takes you to the next panel and at the bottom of the timeline it turns the panel number yellow, but if you click a number on this line it takes you to that panel, but it doesn't actually scroll, so the color of the number doesn't change to that of the new panel and if you scroll it changes you back to the part you were in before you clicked Do you have any idea how I could fix it? I hope I made myself understood ? See the Pen oNoYzQw by marcoantonio-trujano-rodriguez (@marcoantonio-trujano-rodriguez) on CodePen Link to comment Share on other sites More sharing options...
Solution GreenSock Posted February 6, 2022 Solution Share Posted February 6, 2022 You should just animate the scroll position so that everything is coordinated. Like this: See the Pen zYPoNme?editors=0010 by GreenSock (@GreenSock) on CodePen If it were me, though, I'd probably reduce a lot of that code by using loops and reusable functions. When you find yourself writing the same code over and over again except changing one little part (like all those click event listeners), it's usually a good place to use code to automate/simplify that. You could probably do the same for even adding those <spans> to the DOM for the years but that's totally up to you. It's not "wrong" to do it manually. Good luck! 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