Closed mrWilson123 closed 3 years ago
I'd suggest you use the .scrollTo()
method with custom easing functions which would perfectly meet your needs.
Also, instead of using$(href).offset().top
which returns the relative offset to the top side of window, you need to calculate the relative position to the scrollbar container like:
top = $(href).offset().top - $(container).offset().top
Hi, @idiotWu. Thank you for your answer. Can you please show me a real code example because I still can't get it to work properly. :(
To do it quickly, you can change topY
to
topY = $(href).offset().top - $('#scroll-container > .scroll-content').offset().top
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 TweenMax. If you look at it https://codepen.io/Siilionu/pen/poJraMM 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.