function goTop() {
$('html, body').animate({scrollTop:0}, 'slow');
}
function goDiv(div) {
var a = $("#"+div).offset().top;
$("html,body").animate({scrollTop:a}, 'slow');
}
function goBottom() {
window.scrollTo(0, document.documentElement.scrollHeight-document.documentElement.clientHeight);
}
本文介绍了如何使用JavaScript实现页面滚动到指定div元素顶部的功能,包括全局滚动到顶部、特定div元素滚动到顶部以及滚动到底部的方法。
5684

被折叠的 条评论
为什么被折叠?



