如何阻止动画gif循环播放 [英] How to stop an animated gif from looping

查看:113
本文介绍了如何阻止动画gif循环播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在img标签中有一个动画gif,我从重写src属性开始。但是,创建了gif循环,我只希望它播放一次。有没有办法,使用Javascript或jQuery,停止动画gif多次播放?

I have an animated gif in an img tag that I start by rewriting the src attribute. The gif was created, though, to loop and I only want it to play once. Is there a way, with Javascript or jQuery, to stop an animated gif from playing more than once?

推荐答案

不确定是否这样是回应所有人的最佳方式,并在所有之前的答案和评论之后显示,但它似乎有效。

Not sure if this is the best way to respond to everyone and have it appear after all the previous answers and comments, but it seems to work.

我对此没有多少控制权GIF。人们发布他们想要的任何gif作为他们帐户目录中的thankyou.gif然后当一个评论提交到他们发布的表单时,ThankYou代码运行他们放在那里的任何东西。所以有些可能循环,有些可能没有,有些可能很短,有些可能很长。我遇到的解决方法是告诉人们让它们制作5秒,因为那时我会把它们淡出来,我不在乎它们是否循环。

I don't have much control over the gif. People post whatever gif they want as the "thankyou.gif in their account directory and then the ThankYou code runs whatever they've put there when a comment is submitted to a form they've posted. So some may loop, some may not, some may be short, some may be long. The solution I've come to is to tell people to make them 5 seconds, because that's when I'm going to fade them out, and I don't care if they loop or not.

感谢所有的想法。

这篇关于如何阻止动画gif循环播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆