Search code examples
javascriptcssanimationgifanimated-gif

Can you control GIF animation with Javascript?


Is it possible to use javascript to control which frame of a GIF image is showing and/or stop the animation. I want to be able to load a GIF with several frames and only show one of them.

I know I could do it with lots of separate images, but if I can do what I want with a GIF, it will only be one file to worry about.


Solution

  • You can do it with a single image using CSS sprites.