offset() (包含top left)
height()
scrollTop
$("body").scrollTop(**);
原理是修改页面的scrollTop。
jquery动态效果:animate()
$("html,body").animate({ scrollTop: **}, 500);
$("html,body").animate({ scrollTop: $().offset().top-$().height() }, 500);
本文介绍如何使用jQuery操作页面滚动条,包括设置scrollTop属性实现页面滚动,以及使用animate方法平滑滚动到指定位置。
offset() (包含top left)
height()
scrollTop
$("body").scrollTop(**);
原理是修改页面的scrollTop。
jquery动态效果:animate()
$("html,body").animate({ scrollTop: **}, 500);
$("html,body").animate({ scrollTop: $().offset().top-$().height() }, 500);
1384

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