Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

animated gifs freeze in firefox 4.0 and above

I'm using jquery to preload an animated gif and later on inject a message with animated gif to the code. it used to work fine until release 4.0 of firefox. since then only the 1st frame is showed and the animation is frozen. (it works fine on IE and chrome)

I use:

$("<img>").attr("src",image);  // preload the image

And later on:

$(message).insertAfter(obj);  // inject animated gif and some text

[EDIT] Added jsfiddle example: http://jsfiddle.net/na2ku/35/

like image 501
Nir Avatar asked Oct 17 '11 21:10

Nir


1 Answers

Maybe try inserting image object into the document instead of adding simple tag.

var img = new Image();
img.src = "image.gif";
$(img).insertAfter(message);
like image 54
biphobe Avatar answered Sep 27 '22 22:09

biphobe