Answer the question
In order to leave comments, you need to log in
Is it possible to animate scroll to anchor with jquery without using $('html, body') and third party plugins?
The structure of my project requires that <body>
and <html>
always have ovreflow:hidden
. The main child-container #main-wrapper
has overflow-y: scroll
and I'm making every effort to make the scroll animation in this container. However, it turns out that it is $('#my_element').offset().top
always different. Being at the very top of the page and pressing the button - #main-wrapper
it scrolls smoothly. We go down a little while the button is still in view, click on it and the scroll already works incorrectly due to an incorrect $('#my_element').offset().top
.
Here is a sample code.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question