我有一个页面(由我控制),希望它能够自动平滑地滚动(以受控速度滚动,直到页面底部)。这里有一个例子http://tim.theenchanter.com/2008/08/autoscroll-in-safari-firefox.html。有没有可能用jQuery实现这个功能(不是作为书签工具)?
这个例子需要30秒才能滚动到页面底部。
<a href="#bottom">start scrolling</a>
<p> lots of content here </p>
<h2 id="bottom">bottom of page</h2>
<script>
var oneSecond = 1000;
$('a').on('click', function() {
$("html, body").animate({
scrollTop: $(document).height()
}, 30 * oneSecond);
return false;
});
</script>
http://css-tricks.com/snippets/jquery/smooth-scrolling/
并且
查看其他示例。