GIF图像在"document.location.href"时停止

Ori*_*iol 2 javascript gif

我在javascript中有这个功能:

function loadPage (url){
  showLoadPageGif();         // visibility On
  document.location.href = getPath + "/" + url ;  
}
Run Code Online (Sandbox Code Playgroud)

当我使用此功能时,GIF图像显示在屏幕上但不起作用.有人曾经打过这个问题吗?日Thnx

fir*_*ien 7

我最近使用动画SVG作为伪元素中的背景图像遇到了这个问题.我有目的地在我的网络服务器上放了很大的延迟,所以我可以留在当前页面之后window.location = url;很奇怪所有其他CSS动画和悬停仍然有效,但SVG cog只是卡住了.

经过一些游戏,我发现动画继续运行,如果window.location我提交了一份GET表格而不是改变.

var url;
//load & setup loading animation
//then generate and submit form with a slight delay
setTimeout(function(){
  var new_form;
  new_form = document.createElement('form');
  new_form.method = 'GET';
  new_form.action = url;
  document.body.appendChild(new_form);
  new_form.submit();
}, 100)
Run Code Online (Sandbox Code Playgroud)

在safari 5.1,firefox 24,chrome 32上测试