js-click button page scroll to top, bottom, specified position

The reason I took this note down is because I use it a lot in my projects. 

$('.scroll_top').click(function(){ $('html,body').animate({scrollTop: '0px'}, 800) ;}); //Scroll to the top
$('.scroll_a ').click(function(){ $('html,body').animate({scrollTop:$('.a').offset().top}, 800) ;}); //The page scrolls to the specified The position of
$('.scroll_bottom').click(function(){ $('html,body').animate({scrollTop:$('.bottom').offset().top}, 800) ;}) ; //Scroll to the bottom of the page

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324937036&siteId=291194637