3

I am not trying to pause or do anything fancy. I just want to click on the animated gif and stop it. If I click again I would like it to play from the beginning. Is there a simple solution to this that will work in all browsers? Would swapping the animated gif for the first frame of the gif in the DOM be a safe way to do this?

smuggledPancakes
  • 9,881
  • 20
  • 74
  • 113
  • 1
    *"I am not trying to pause [...] I just want to click on the animated gif and pause it"*. You mean you want to stop it, not pause it ? – Denys Séguret Jun 09 '14 at 16:27
  • 1
    Are you also trying to stop images coming from other origins ? If so it will be hard to swap the image for its first frame. If not, you can do [this](http://stackoverflow.com/questions/3688460/stopping-gif-animation-programmatically) – Denys Séguret Jun 09 '14 at 16:29
  • I mistyped, I meant "stop it" not "pause it". The images are not coming from other origins. I should have specified that this is all being done offline in a help system for a Swing Desktop Aplication. – smuggledPancakes Jun 09 '14 at 17:14
  • 1
    You cannot start and stop a gif. What you can do is store a still version and place it ontop when you want the gif to appear stopped. – Fresheyeball Jun 09 '14 at 17:19
  • you can also use sprites and create an animation with all of the frames. That should enable you do do what you want – Adjit Jun 09 '14 at 17:21
  • By place it on top do you literally mean on top in some kind of layer or do you mean swapping out. That is what I am trying to do. – smuggledPancakes Jun 09 '14 at 17:21
  • 1
    use spritepad http://wearekiss.com/spritepad – Adjit Jun 09 '14 at 17:31
  • @smuggledPancakes did you see the link I gave you ? In your case doesn't it work ? – Denys Séguret Jun 09 '14 at 17:53

1 Answers1

2

the another sites create two files for this.
thumbnail as JPG files for showing on default
and Gif file when you click on JPG files GIF file replace with that and start to download and showing when you click again on GIF file you see JPG thumbnail.
this is a trick for showing you and you think yourself this is stop and playing system.

H.Rafiee
  • 358
  • 1
  • 9