jquery.lazyload的使用

1.引入

<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.lazyload.js" type="text/javascript"></script>

2.img处理

<img class="lazy" data-original="img/example.jpg">

3.调用方法,配置参数

$(document).ready(function(){
        $("img.lazy").lazyload({
            effect : "fadeIn",
            failure_limit : 1000,
            threshold : 2000 // 默认情况下图片会出现在屏幕时加载. 如果你想提前加载图片, 可以设置threshold 选项, 设置 threshold 为 200 令图片在距离屏幕 200 像素时提前加载
        });
});
posted @ 2016-03-29 15:02  TBHacker  阅读(282)  评论(0编辑  收藏  举报