在我的页面完成加载后。我希望jQUery能够很好地滚动到页面的底部,快速生成动画,而不是一个快照/颠簸。

我需要像ScrollTo这样的插件吗?或者这是内置到jQuery的某种方式?


当前回答

对于jQuery 3,请更改

$(窗口).load(函数(){ $ (" html,身体”)。animate({scrollTop: $(document).height()}, 1000); })

to:

美元(窗口)。On ("load",函数(e) { $ (" html,身体”)。animate({scrollTop: $(document).height()}, 1000); })

其他回答

就像这样:

var $target = $('html,body'); 
$target.animate({scrollTop: $target.height()}, 1000);
$('html,body').animate({ scrollTop: 9999 }, 'slow');

就这么简单,9999页高…范围大,所以可以到达底部。

function scrollToBottom() {
     $("#mContainer").animate({ scrollTop: $("#mContainer")[0].scrollHeight }, 1000);
}

这是我和你们找到的解,我确定

你可以试试这个

var scroll=$('#scroll');
scroll.animate({scrollTop: scroll.prop("scrollHeight")});

js

var el = document.getElementById("el");
el.scrollTop = el.scrollHeight - el.scrollTop;