开发者

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. Any ideas how to fix this? ie. I see the gif ok but it not being animated. Is there another way in Javascript to force the redirect once the gif animation starts?

<div id="loading">
</div>

<script type="text/javascript" charset="utf-8">
   function show_spinner() {
     $("form").hide开发者_StackOverflow()
     $("loading").show()
     window.location = "/weekends/display"
    }
   window.onload=show_spinner;
</script>

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜