Javascript 如何在JQuery中调用动画后重新加载
我正在构建一个新闻提要样式的页面,该页面将自动滚动到底部,然后等待并刷新页面并重复该过程 自动重新加载目前不起作用,它开始困扰我 非常感谢您的帮助 滚动部分工作得很好 我的代码当前Javascript 如何在JQuery中调用动画后重新加载,javascript,jquery,Javascript,Jquery,我正在构建一个新闻提要样式的页面,该页面将自动滚动到底部,然后等待并刷新页面并重复该过程 自动重新加载目前不起作用,它开始困扰我 非常感谢您的帮助 滚动部分工作得很好 我的代码当前 <script language="javascript" type="text/javascript"> function scrolll() { time = $('.message').length*3000; $("html, body").animate({ scrollTop:
<script language="javascript" type="text/javascript">
function scrolll() {
time = $('.message').length*3000;
$("html, body").animate({ scrollTop: 0 }, 0);
$("html, body").animate({ scrollTop: $(document).height() }, time,0, function() {location.reload; });
;
}
</script>
函数scrolll(){
时间=$('.message')。长度*3000;
$(“html,body”).animate({scrollTop:0},0);
$(“html,body”).animate({scrollTop:$(document).height()},time,0,function(){location.reload;});
;
}
您可以使用
location.reload();
或
但是我认为你的时间问题,0
$("html, body").animate({ scrollTop: $(document).height() }, time, function() {location.reload(); });
如果我理解,您可以使用setTimeout()
首先,尝试更改
location.reload;
到
(这也将避免在重新加载()时使用页面缓存)
接下来,考虑动画签名:
.animate(属性[,持续时间][,缓和][,完成]) 在动画中,您将0
作为名称传递
.animate({...}, time, 0, function() ...
这将阻止动画启动。请完全忽略此项,或者传入一个有效的名称,例如“linear”。如果您感兴趣,请参阅以了解函数名称
location.reload;
location.reload(true);
.animate({...}, time, 0, function() ...