简体   繁体   English

JavaScript问题-为什么“ window.location”不能确保我的spinner.gif动画能够正常工作?

[英]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;
}

Unless someone can show me otherwise I'm proposing it is not possible.... 除非有人可以给我看,否则我建议这是不可能的。

I have solved my problem a different way however per this post 我根据这篇文章以不同的方式解决了我的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM