在 HTML 中禁用 GIF 动画 [英] Disabling GIF animation in HTML

查看:48
本文介绍了在 HTML 中禁用 GIF 动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 HTML 中,有什么方法可以在 中包含动画 GIF?标签,但自动告诉 GIF 不动画?我意识到用户可以通过按 ESC 或单击停止来停止动画,但我希望 GIF 根本不动画.

Is there any way, in HTML, to include an animated GIF in an <img> tag, but automatically tell the GIF to not animate? I realize that the user can stop animation by pressing ESC or clicking Stop, but I want the GIFs not to animate at all.

我只想在一个特定页面上执行此操作,并且制作单独的(1500 多个)GIF 的非动画版本是不可行的.我只是想让 GIF 没有动画.

I only want to do this on one specific page, and making separate non-animated versions of the (1500+) GIFs is not feasible. I simply want the GIFs to not animate.

推荐答案

你可以使用 Giffer.

只需在您的页面中包含库:

Just include the library in your page:

<script type="text/javascript" src="gifffer.min.js"></script>

不要在图像上设置 src 属性,而是使用 data-gifffer.

Instead of setting src attribute on your image use data-gifffer.

<img data-gifffer="image.gif" />

最后,随时调用 Gifffer().例如:

At the end, call Gifffer() whenever you want. For example:

window.onload = function() {
    Gifffer();
}

如果您根本不希望 GIF 移动,您可以随时编辑 .js 文件以删除播放按钮.

If you don't want the GIF to move at all you can always edit the .js file to remove the play button.

这篇关于在 HTML 中禁用 GIF 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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