Restart an animated GIF from JavaScript without reloading the image

You should preload your images into code.

var image = new Image();
image.src = "https://stackoverflow.com/questions/3191922/path";

when you want to use:

nextimg_img.attr('src', image.src);

Then when you swap the src out just swap from the preloaded image objects. That should do the trick to avoid redownloading.

Leave a Comment