更新时间:2023-11-26 11:42:16
另一个选项是触发 onload
和/或 onerror
事件创建内存图像元素并将其 src
属性设置为原始图像的原始 src
属性。以下是我的意思:
Another option is to trigger the onload
and/or onerror
events by creating an in memory image element and setting its src
attribute to the original src
attribute of the original image. Here's an example of what I mean:
$("<img/>")
.on('load', function() { console.log("image loaded correctly"); })
.on('error', function() { console.log("error loading image"); })
.attr("src", $(originalImage).attr("src"))
;
希望这有帮助!