zoukankan      html  css  js  c++  java
  • 延迟加载图片

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script>
    var wait_load = $('.wait_load');
    wait_load.opacity(0);
    $(window).bind('scroll', function () {
    setTimeout(function () {
    for (var i = 0; i < wait_load.length(); i ++) {
    var _this = wait_load.ge(i);
    if ((getInner().height + getScroll().top) >= offsetTop(_this)) {
    $(_this).attr('src', $(_this).attr('xsrc')).animate({
    attr : 'o',
    target : 100,
    t : 30,
    step : 10
    });
    }
    }
    }, 100);
    });
    </script>
    </head>
    <body>
    <div id="photo">
    <dl>
    <dt><img xsrc="images/p1.jpg" src="images/wait_load.jpg"
    class="wait_load" /></dt>
    <dd>延迟加载图片</dd>
    </dl>

    <dl>
    <dt><img xsrc="images/p2.jpg" src="images/wait_load.jpg"
    class="wait_load" /></dt>
    <dd>延迟加载图片</dd>
    </dl>

    <dl>
    <dt><img xsrc="images/p3.jpg" src="images/wait_load.jpg"
    class="wait_load" /></dt>
    <dd>延迟加载图片</dd>
    </dl>
    </div>
    </body>
    </html>

  • 相关阅读:
    alpha冲刺9
    alpha冲刺8
    alpha冲刺7
    alpha冲刺6
    团队作业——随堂小测(同学录)
    alpha冲刺5
    alpha冲刺4
    alpha冲刺3
    设计模式——桥接模式
    Java基础——关键字
  • 原文地址:https://www.cnblogs.com/annie211/p/6016696.html
Copyright © 2011-2022 走看看