How To Scroll Top In Jquery. When this method is used. Jquerys offset function returns an object containing properties top and left.
Use the id of your destination on the page slow. To perform a simple scroll to the top of the page on button click. You have to specify it in the pixel.
Your issue has to do with css specificity add the id to the new class ruleset like this.
Code snippets for our smooth jquery scroll to top button. Jquery scrolltop the jquery scrolltop method is used to set or return the vertical scrollbar position for the selected element. This behavior can be used to scroll to the top of the page by applying this method on the window property. When used to set the position.