如何检查图像是否正在预加载?(How to check if images are being preloaded?)

编程入门 行业动态 更新时间:2024-10-28 08:31:42
如何检查图像是否正在预加载?(How to check if images are being preloaded?)

我想用javascript预加载图像,下面的方法似乎很简单,但我如何检查图像是否已预加载? 谢谢使用jQuery预加载图像

I want to preload an image with javascript, the method below seems simple enough but how can I check if the image has preloaded? Thanks Preloading images with jQuery

最满意答案

我建议修改代码,将'onerror'事件处理程序添加到您正在生成的img标记中。 然后处理任何失败。

http://www.w3schools.com/jsref/event_onerror.asp

I would suggest modifying the code to add on 'onerror' event handler to the img tags you are generating. and then handle any failures.

http://www.w3schools.com/jsref/event_onerror.asp

更多推荐

本文发布于:2023-08-03 02:44:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1383139.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图像   加载   check   images   preloaded

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!