Does anyone know a work around to make animated GIF's continue to be animated after you click a link or submit a form on the page your on in IE? This works fine in other browsers.
Thanks.
Does anyone know a work around to make animated GIF's continue to be animated after you click a link or submit a form on the page your on in IE? This works fine in other browsers.
Thanks.
The accepted solution did not work for me.
After some more research I came across this workaround, and it actually does work.
Here is the gist of it:
and in your html:
So when the form is submitted, the
<img/>
tag is inserted, and for some reason it is not affected by the ie animation issues.Tested in Firefox, ie6, ie7 and ie8.
I encountered this problem when trying to show a loading gif while a form submit was processing. It had an added layer of fun in that the same onsubmit had to run a validator to make sure the form was correct. Like everyone else (on every IE/gif form post on the internet) I couldn't get the loading spinner to "spin" in IE (and, in my case, validate/submit the form). While looking through advice on http://www.west-wind.com I found a post by ev13wt that suggested the problem was "... that IE doesn't render the image as animated cause it was invisible when it was rendered." That made sense. His solution:
Leave blank where the gif would go and use JavaScript to set the source in the onsubmit function - document.getElementById('loadingGif').src = "path to gif file".
Here's how I implemented it:
This worked well for me in all browsers!
I had this same problem, common also to other borwsers like Firefox. Finally I discovered that dynamically create an element with animated gif inside at form submit did not animate, so I developed the following workaorund.
1) At
document.ready()
, each FORM found in page, receiveposition:relative
property and then to each one is attached an invisibleDIV.bg-overlay
.2) After this, assuming that each submit value of my website is identified by
btn-primary
css class, again atdocument.ready()
, I look for these buttons, traverse to the FORM parent of each one, and at form submit, I fireshowOverlayOnFormExecution(this,true);
function, passing clicked button and a boolean that toggle visibility ofDIV.bg-overlay
.CSS for
DIV.bg-overlay
is the following:3) At any form submit, the following function is fired to show a semi-white background overlay all over it (that deny ability to interact again with form) and an animated gif inside it (that visually show a loading action).
Showing animated gif at form submit, instead of appending it at this event, solves "gif animation freeze" problem of various browsers (as said, I found this problem in IE and Firefox, not in Chrome)
Just had a similar issue. These worked perfectly for me.
Another idea was to use jQuery's .load(); to load and then prepend the image.
Works in IE 7+