Controlling GIF Animations with Jquery?

孤者浪人 提交于 2019-12-23 12:53:49

问题


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.


回答1:


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.




回答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.




回答3:


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.



来源:https://stackoverflow.com/questions/6321997/controlling-gif-animations-with-jquery

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!