設(shè)置頁面加載時(shí)滾動條自動滾到底的方法:
jQuery:
復(fù)制代碼代碼如下:
$(function(){
var h = $(document).height()-$(window).height();
$(document).scrollTop(h);
});
JavaScript:
復(fù)制代碼代碼如下:
window.onload = function(){
var h = document.documentElement.scrollHeight || document.body.scrollHeight;
window.scrollTo(h,h);
}
以上2種方法均可以實(shí)現(xiàn)頁面加載時(shí)滾動條自動滾動到底,小伙伴們根據(jù)自己的實(shí)際需求,自由選擇吧