$('.lazy').each(function(){
if($(window).scrollTop() + window.innerHeight > $(this).offset().top){
images($(this));
}
});
window.onscroll = function(){
$('.lazy').each(function(){if($(window).scrollTop() + window.innerHeight > $(this).offset().top){
images($(this));
}
});
}
function images(imgobj){
var img = new Image();
var imgsrc=imgobj.attr('imgsrc');
img.onload = function () {
if(img.complete == true){
imgobj.attr('src', imgsrc);
imgobj.removeClass('lazy');
imgobj.removeAttr('imgsrc');
}
} ;
img.src = imgsrc;
}
<img imgsrc="图片的真实地址" />