4

Is this possible? I did some google search but don't seem to find anything. What I want would be kind of like a stop/play function to a gif image.

Would be awesome.

Naota
  • 668
  • 2
  • 12
  • 17

3 Answers3

9

No. Gifs are played by the browser. There is nothing you can do about it.

The only thing you can do is replace the image with a placeholder. But that will not stop and start the gif at specific locations of the animation, right when you click/toggle.

Kissaki
  • 8,810
  • 5
  • 40
  • 42
2

https://stackoverflow.com/a/6017468/873792

Unfortunately, the DOM doesn't expose individual frames of a GIF, so this is done by downloading the GIF (with XMLHttpRequest), parsing it, and drawing it on a canvas.

Community
  • 1
  • 1
user873792
  • 323
  • 2
  • 8
0

You cannot control a GIF with jquery, I've tried many times.

What you can do is use libraries to split into single frames and then show one of these as a placeholder instead.

  • 1
    Tried different approaches I meant. There would actually be ways to do it, but they would require changes to the GIF protocol at the bottom layer, which is unfeasible as this is not the purpose of the GIF format. (This would render the protocol into the region of video, which goes against fundamental tenants.) – Markosaurus Nov 26 '14 at 16:52