gif 动画结束时显示文本
我在互联网上搜索,但没有找到正确的答案。 例如,如果我有:
<img src="gif.gif" loop="false" />
如何使该 div.. 在最后一帧后显示文本? Javascript中有什么函数或者类似的东西吗? 谢谢..
i was searching throught the internet but i didnt find the right answer..
If i have for example:
<img src="gif.gif" loop="false" />
How to make this div.. to display text after last frame?
Is there any function in Javascript or something like that?
Thank you..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一旦确定了 .gif 文件的时间,您将需要使用 JavaScript 函数来按提示显示 div。
这都是伪代码。必须对其进行调整以满足您的需求和时间安排。我很可能认为您需要 SetTimeout 在页面加载时运行。
Once you have the timing of the .gif file down, you will need to use a JavaScript function to display the div on cue.
This is all pseudo-code. It will have to be tweaked to meet your needs and timing. Most likely I'd think you would need the SetTimeout to run on page load.
据我所知,GIF动画帧和JavaScript之间没有交互的方式。
一个建议是将动画移动到画布上。
正如 Joel 所建议的,SetTimeout 非常不可靠,并且依赖于浏览器,据我所知。
As far as I know, there is no way of interacting between GIF animation frames and JavaScript.
One suggestion would be to move that animation to canvas.
SetTimeout, as suggested by Joel, is quite unreliable and is browser dependant, AFAIK.