【发布时间】:2016-09-15 09:22:19
【问题描述】:
我希望我的页面在自动向下滚动后自动刷新...这是我关于如何自动上下滚动的代码。
function scroll(speed) {
$('html, body').animate({ scrollTop: $(document).height() }, speed, function() {
$(this).animate({ scrollTop: 0 }, speed);
});
}
speed = 25000;
scroll(speed)
setInterval(function(){scroll(speed)}, speed * 2);
【问题讨论】:
-
多解释一点
-
如果它在触底时刷新,那么您不会看到它返回?你可以在你的第二个动画中添加另一个完整的函数,比如
function(){ location.reload(); },这样你就不需要你的 setInterval 调用了。 -
所以你的意思是@Sam0,我将替换 setInterval(function(){scroll(speed)}, speed * 2); to function(){ location.reload(); } ??
标签: jquery ajax jquery-animate