Thursday, April 24, 2014

Reanimate an animated gif when javascipt makes visible

To get an animated gif to work after some javascript adjusts the visibility, create a new instance


function Loading() {
   var wait = document.getElementById('loadingGif');

   if (wait != null) {
     wait.style.display = "inline";
     var newInstance = wait.cloneNode(true); //This will reanimate the gif
     wait.parentNode.replaceChild(newInstance, wait);
   }
}
 

No comments: