Compsoft Flexible Specialists

Compsoft plc

Compsoft Weblog Compsoft Website News Archive Privacy Policy Contact Us  

Monday, June 15, 2009

Animated gifs stop animating in IE

An annoying bug/ feature of Internet Explorer is that animated gifs stop animating the moment you click a link to navigate to another page. Other things can stop them animating too: I recently found that a flash-based file uploader that we use triggers this bug when it finishes the upload.

Fortunately it's not to hard to work around. If you reassign the value of the src attribute of the <img> tag, the animation starts again.

jQuery makes it easy to reassign all such tags in one fell swoop:

//codesnippet:7660712A-6D8A-4820-A99F-751F44A57AD2
function fixAnimatedGifsDamnYouInternetExplorer()
{
    $("img").each(function()
    {
        this.src = this.src;
    });
}

In my case, I called this function when my upload completed, but you could easily attach it to the click event of every link on your page.

0 Comments:

Post a Comment

<< Home