jQuery 闪烁/Flash 动画
有谁知道一个简洁的 jQuery 效果可以使图像随机闪烁或闪烁?这里的大多数帖子都是“如何停止闪烁”等,因此很难找到有关实际故意使图像闪烁的任何内容。
Does anyone know of a neat jQuery effect that will make an image randomly flicker or flash? Most of the posts on here are "how to stop flickering" etc, so it's pretty hard to find anything about actually making the image flicker ON PURPOSE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将此作为您的 HTML:
将此用作您的 javascript:
如果有人对此有反馈,请告诉我。我不确定这是否是最安全的做事方法。我倾向于避免使用 setTimeout,但我不知道还有其他方法可以做到这一点。这是随机闪烁,因此当 img 可见时,它将每 100 秒以 0.5 的概率设置为隐藏,而当它隐藏时,每 100 秒将以 0.5 的概率将其设置为可见。可以针对不同类型的闪烁调整超时参数。
让我知道你的想法。
With this as your HTML:
Use this as your javascript:
If anyone has feedback on this, lemme know. I'm not sure if this is the safest method of doing things. I tend to avoid using setTimeout, but I don't know of any other way to do this. This is a random flicker so when the img is visible, it will be set to hidden with 0.5 probability every 100 seconds and when it is hidden, it will be set to visible with 0.5 probability every 100 seconds. The timeout parameters can be tuned for different kinds of flickers.
Let me know what you think.