我想要做:
$("img").bind('load', function() { // do stuff });
但是从缓存加载图像时不会触发加载事件.jQuery文档提出了一个修复此问题的插件,但它不起作用
jquery image jquery-load jquery-events
我想在加载图像后创建一个警告框,但如果图像保存在浏览器缓存中,.onload则不会触发该事件.
.onload
无论图像是否已被缓存,如何在加载图像时触发警报?
var img = new Image(); img.src = "img.jpg"; img.onload = function () { alert("image is loaded"); }
javascript image-loading
image ×1
image-loading ×1
javascript ×1
jquery ×1
jquery-events ×1
jquery-load ×1