//Image lazy loading
$(function(){
$("img").lazyload({
effect: "fadeIn", //Automatically overwrite the default image after the image is loaded
failure_limit: "100"//As soon as the page loads, find 100 images to put on the loading style image .
});
//Some pictures may not be available, so make judgment and add the default picture
$("img").each(function(){
if($(this).attr("data-original") == "/ baqxx/static/assets/images/loading4.gif" ||$(this).attr("data-original") == ""){
$(this).attr("src","/baqxx/static/ assets/images/noImg.jpg");
}
});
})
jsp code
<img width="265" height="230" src = "${ctx}/static/assets/images/loading4.gif" data-original="${l.imgsrc}">
Imported jar package
<script src="${ctx}/static/assets/js/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="${ctx}/static/assets/js/jquery.lazyload.min.js" type="text/javascript"></script>
//jar package connection
https://pan.baidu.com/s/12-pRxWPUM5rGiaMzXgPZHw