js實現
1、window.scrollTo(0,document.documentElement.clientHeight); //js
jq實現
2 、var windowHeight = parseInt($("body").css("height"));//jq
$("#toBottom").click(function () {
$("html,body").animate({ "scrollTop": windowHeight }, 200);
});
同理回到頂部js實現只需要改為scrollTo(0,0),jq只需要改為"scrollTop": 0