mrWilson Posted March 4, 2020 Share Posted March 4, 2020 Hi, I'm trying to get smooth scrolling to work properly, but unfortunately I can't handle it myself (sorry, I'm pretty new of this). I'm using a scrollToPlugin and external plugin called "Smooth Scrollbar". If you look at it you will see that it is not working properly. Clicking on the link will move it chaotically. Also, if you click on the link multiple times, the page will move up and down, though it shouldn't. Hopefully someone can help me with this. Thank you. See the Pen poJraMM by Siilionu (@Siilionu) on CodePen Link to comment Share on other sites More sharing options...
Shrug ¯\_(ツ)_/¯ Posted March 4, 2020 Share Posted March 4, 2020 Hi @mrWilson and welcome to the GreenSock forums. Unfortunatly I believe the issue is more relative to the Smooth Scroll library and not specific to GSAP. https://github.com/idiotWu/smooth-scrollbar/issues?q=scrollto You can see that fact mentioned by its developer here: https://github.com/idiotWu/smooth-scrollbar/issues/128#issuecomment-350692283 In that above discussion you will find some suggestions that might help, or you would need to write your own logic to try an overcome it. You can also check out the API for that library, which may have something helpful. https://github.com/idiotWu/smooth-scrollbar/blob/develop/docs/api.md At least thats my observation, someone else may say otherwise ¯\_(ツ)_/¯. 5 Link to comment Share on other sites More sharing options...
mrWilson Posted March 4, 2020 Author Share Posted March 4, 2020 Thanks, @Shrug ¯\_(ツ)_/¯. That's what I suspected but I wasn't quite sure. I'm trying to ask them to help. Anyway, if anyone here knows the solution then let me know. I would be very grateful. Link to comment Share on other sites More sharing options...
ZachSaucier Posted March 4, 2020 Share Posted March 4, 2020 Trying to pair smooth scroll with other scroll animation is difficult because both try to control the scroll position. Likely the easiest way to keep both working is to disable the smooth scroll functionality while the scroll position is being animated. Then enable the smooth scroll functionality after the animation is complete, making sure that it's functioning correctly with the new position. Alternatively you could do both the smooth scroll and scrolling to position using GSAP by way of a proxy. Big picture is you'd have a variable to keep track of the scroll position and update that variable when the user scrolls or a button is clicked. And when it updates, you also update the scroll position of the page. 1 Link to comment Share on other sites More sharing options...
mrWilson Posted March 4, 2020 Author Share Posted March 4, 2020 Thank you for the answer @ZachSaucier Uhh.. Right now it sounds like rocket science to me. Unfortunately, I have no clue how to do it. 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