HTML:
<img src='${defalutImg}' data-src="${fileDomain }/images/${poi.firstPic}" width="90" height="66" />
JS:
/**
* 图片加载成功时,将默认图片替换为真实图片
*/
function imgNetPing() {
$('img').each(function() {
var _this = $(this);
//真实的图片路径
var imgurl = _this.attr("data-src");
//判断是否加载成功
var netPing = new Image();
netPing.onload = function() {
//替换为真实图片
_this.attr("src", imgurl);
};
netPing.src = imgurl;
})
}