GIF图像在“document.location.href”时停止。 [英] GIF Image Stops when "document.location.href"
问题描述
我在javascript中有这个功能:
I have this function in javascript :
function loadPage (url){
showLoadPageGif(); // visibility On
document.location.href = getPath + "/" + url ;
}
当我使用此功能时,GIF图像显示在屏幕上但不起作用。
有人曾经打过这个问题吗? thnx
When I use this function , GIF image is displayed in the screen but not working . someone has fought before, with this problem ? thnx
推荐答案
我最近使用动画SVG作为伪元素中的背景图像遇到了这个问题。我有目的地在我的网络服务器上放了很大的延迟,所以我可以在 window.location = url;
之后留在当前页面上。所有其他CSS动画和悬停仍然有效是很奇怪的但是,SVG cog卡住了。
i recently ran into this issue using animated SVGs as background-images in pseudo elements. I purposefully put in a large delay on my webserver so i could stay on the current page after window.location = url;
It was weird that all other CSS animations and hovers still worked, but the SVG cog just stuck.
经过一些游戏,我发现动画继续运行,而不是改变 window.location
,我提交了一份GET表格。
After some playing around i found that the animations continued to run if, instead of changing window.location
, i submitted a GET form.
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)
在safari 5.1上测试,firefox 24,chrome 32
tested on safari 5.1, firefox 24, chrome 32
这篇关于GIF图像在“document.location.href”时停止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!