Search code examples
javascriptjqueryhtmlgif

Is there a way of syncing gif files?


I have a page with 7 gif files on it.

Is there a way to sync them all, so they start playing at the same time?

I was thinking of preloading them, but still they may not start synced if one takes longer to load than another.


Solution

  • As @Archer pointed out above, one way to do it is to preload them then reset the src. Using jquery you could do something like:

    $(window).load(function() {
        $('.preload').attr('src', function(i,a){
            $(this).attr('src','').removeClass('preload').attr('src',a);
        });
    });
    

    See it on jsfiddle.