Is there any way, how to synchronize gif animations? Problem is that if they have same timing, but are loaded in different time, it can looks strange. I don't know, for example by some javascript "refresh" or reload or something else...
Asked
Active
Viewed 1,182 times
1 Answers
3
GIF animations are not scriptable. The best you can do is load them via JavaScript, then insert them both into the DOM after they've loaded.
Something like this:
var img = new Image();
var imgCount = 0;
img.onload = loadCount;
img.src="....."
var img2 = new Image();
img2.onload = loadCount;
img2.src="....."
function loadCount() {
imgCount++;
if(imgCount==2) {
//insert IMG tags into DOM
}
}

Diodeus - James MacFarlane
- 112,730
- 33
- 157
- 176
-
It should be noted that Chrome, at least, doesn't play the gif if it has `display: none`. I believe certain browsers (not sure which anymore) behave the same if the gif is outside the viewport (due to scrolling etc). This load trick is indeed the best one can do, but is not fully reliable. – pimvdb Sep 21 '12 at 08:23