[英]javascript question - why does “window.location” not ensure my spinner.gif animation works?
It seems when I use "window.location" as a means to redirect to the API when my longer running transaction is does not ensure the animation for the spinner gif I have works. 看来,当我使用较长时间的事务不能确保我拥有的Spinner gif的动画有效时,当我使用“ window.location”作为重定向到API的方式时。 Any ideas how to fix this?
任何想法如何解决这一问题? ie.
即。 I see the gif ok but it not being animated.
我看到gif正常,但没有动画。 Is there another way in Javascript to force the redirect once the gif animation starts?
一旦gif动画开始,Javascript中还有另一种方法来强制重定向吗?
<div id="loading">
</div>
<script type="text/javascript" charset="utf-8">
function show_spinner() {
$("form").hide()
$("loading").show()
window.location = "/weekends/display"
}
window.onload=show_spinner;
</script>
CSS: CSS:
#loading {
width:100px;
height: 100px;
position: fixed;
top: 50%;
left: 50%;
background:url(/images/ajax-loader.gif) no-repeat center #fff;
text-align:center;
padding:10px;
font:normal 16px Tahoma, Geneva, sans-serif;
# border:1px solid #666;
margin-left: -50px;
margin-top: -50px;
z-index:2;
overflow: auto;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.