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

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


当前回答

对于jQuery 3,请更改

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

to:

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

其他回答

对于jQuery 3,请更改

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

to:

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

使用“document.body。clientHeight'你可以得到身体元素的可见高度

$('html, body').animate({
    scrollTop: $("#particularDivision").offset().top - document.body.clientHeight + $("#particularDivision").height()
}, 1000);

这个滚动在id ' speciardivision '处

$("div").scrollTop(1000);

对我有用。卷轴到底。

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

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

js

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