How to scroll vertically to a line, in HTML automatically?
This question already has an answer here:
$(document).ready(function()
{
$("html,body").animate({scrollTop: 200}, 1000);
}
没有测试,所以让我知道,如果它不会工作
$(document).ready(function(){
var scrolldiv = $('#content');
$('html, body').animate({
scrollTop: $(scrolldiv).offset().top
}, 1000);
});
scrolldiv将成为包装html内容的元素;
链接地址: http://www.djcxy.com/p/23098.html上一篇: 动画锚链接
下一篇: 如何自动在HTML中垂直滚动一行?