Search code examples
jqueryfirefoxgiffreezeanimated

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/


Solution

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

    var img = new Image();
    img.src = "image.gif";
    $(img).insertAfter(message);