lazyload

http://www.w3schools.com/jsref/event_onload.asp

onload is most often used within the <body> element to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.).

http://www.cnblogs.com/xiaohuochai/p/4859899.html

给图片增加data-original = "img/test.jpg"的属性,保存图片的真实地址

 

<img src="loading.gif" w_src="w_img_url" >


<script>
    window.onload = function(){
        var w_imgs =  document.images;
        len = w_imgs.length;
        for(var w = 0; w<len; w++){
            var w_img = w_imgs[w];
            var w_img_src = w_img.getAttribute('w_img_src');
            w_img.src = w_img_src;
        }
    }
</script>

 

posted @ 2016-11-11 18:41  papering  阅读(152)  评论(0编辑  收藏  举报