feng20121101 2016-03-01 11:25 采纳率: 0%
浏览 1422

jquery 实现图片的缓加载功能

目标:实现界面上图片的按需加载——即缓加载;
难点:页面是使用模板生成的;
如下:

    <script type="text/html" >
    <div class="entry">
    <img src="../js/img/grey.gif" data-original="../js/img/bmw_m1_hood.jpg" width="765" height="574" alt="BMW M1 Hood"><br/>
    <img src="../js/img/grey.gif" data-original="../js/img/bmw_m1_side.jpg" width="765" height="574" alt="BMW M1 Side"><br/>
    <img src="../js/img/grey.gif" data-original="../js/img/viper_1.jpg" width="765" height="574" alt="Viper 1"><br/>
    <img src="../js/img/grey.gif" data-original="../js/img/viper_corner.jpg" width="765" height="574" alt="Viper Corner"><br/>
    <img src="../js/img/grey.gif" data-original="../js/img/bmw_m3_gt.jpg" width="765" height="574" alt="BMW M3 GT"><br/>
    <img src="../js/img/grey.gif" data-original="../js/img/corvette_pitstop.jpg" width="765" height="574" alt="Corvette Pitstop"><br/>
    </div>
    </script>

<script type="text/javascript" src="../js/jquery.lazyload.min.js"></script>
  <script type="text/javascript" charset="utf-8">
     $$(function(){

        var LazyImg=$("#mainListBlock img.lazy");
        LazyImg.show().lazyload({container: $("#mainListBlock") });
    });
  </script>
  • 写回答

2条回答

  • devmiao 2016-03-01 21:19
    关注
    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型