咨询电话:186 7916 6165 咨询电话:186 7916 6165 (微信同号)    在线QQ:181796286
NEWS BLOG ·
学无止境
关注开优网络 关注前沿
没有了
jQuery 控制图片大小

图片缓存加载 jquery.scrollLoading

发表日期:2015-08-20    文章编辑:南昌开优网络    浏览次数:3929    标签:jQuery应用

引用jquery.scrollLoading.js文件

<img width="600" class="scrollLoading" data-url="images/2.jpg" height="400" src="http://www.zhangxinxu.com/study/image/pixel.gif" style="background:url(images/loading.gif) no-repeat center;" />

//在</body>之后加上
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> 
<script src="js/jquery.scrollLoading.js"></script> 
<script>
$(function() {
$(".scrollLoading").scrollLoading();   // class="scrollLoading" 的图片使用 scrollLoading方法
});
</script>

使用说明
1、图片要定义  width 和 height值
2、图片的class加上scrollLoading
3、图片的data-url即图片的地址
4、图片的scr 为 1 X 1 px的透明图片占位符 用于兼容 ie 下的图片错误
5、图片的 style 为加载图片动画