This article mainly introduces how to use jqueryanimate to create a smooth scroll effect. The effect can be rolled to the top, to the bottom, or to a specified place on the page. The result is very smooth and comfortable, it is really convenient for a friend who needs to jump to the page by using the anchor. but to increase the effect of the webpage, you can use the animate in jquery to implement a rolling action, scroll slowly to the position you want to jump to, and it looks very tall.
Scroll to the top:
The code is as follows:
$ ('. Scroll_top'). click (function () {$ ('HTML, body'). animate ({scrollTop: '0px '}, 800 );});
Scroll to the specified position:
The code is as follows:
$ ('. Scroll_a '). click (function () {$ ('HTML, body '). animate ({scrollTop: $ ('. A '). offset (). top }, 800 );});
Complete instance source code reference:
The code is as follows:
Js smoothly scrolls to the top, bottom, and specified place