src/lay/modules/flow.js
function(item, height){
      var start = scrollElem.scrollTop(), end = start + height;
      var elemTop = notDocment ? function(){
        return item.offset().top - scrollElem.offset().top + start;
      }() : item.offset().top;

      /* 始终只加载在当前屏范围内的图片 */
      if(elemTop >= start && elemTop <= end){
        if(!item.attr('src')){
          var src = item.attr('lay-src');
          layui.img(src, function(){
            var next = that.lazyimg.elem.eq(index);
            item.attr('src', src).removeAttr('lay-src');
            
            /* 当前图片加载就绪后，检测下一个图片是否在当前屏 */
            next[0] && render(next);
            index++;
          });
        }
      }
    }
function(item, height){
      var start = scrollElem.scrollTop(), end = start + height;
      var elemTop = notDocment ? function(){
        return item.offset().top - scrollElem.offset().top + start;
      }() : item.offset().top;

      /* 始终只加载在当前屏范围内的图片 */
      if(elemTop >= start && elemTop <= end){
        if(!item.attr('src')){
          var src = item.attr('lay-src');
          layui.img(src, function(){
            var next = that.lazyimg.elem.eq(index);
            item.attr('src', src).removeAttr('lay-src');
            
            /* 当前图片加载就绪后，检测下一个图片是否在当前屏 */
            next[0] && render(next);
            index++;
          });
        }
      }
    }
function ( item , height ) { var start = scrollElem . scrollTop ( ) , end = start + height ; var elemTop = notDocment ? function ( ) { return item . offset ( ) . top - scrollElem . offset ( ) . top + start ; } ( ) : item . offset ( ) . top ; /* 始终只加载在当前屏范围内的图片 */ if ( elemTop >= start && elemTop <= end ) { if ( ! item . attr ( 'src' ) ) { var src = item . attr ( 'lay-src' ) ; layui . img ( src , function ( ) { var next = that . lazyimg . elem . eq ( index ) ; item . attr ( 'src' , src ) . removeAttr ( 'lay-src' ) ; /* 当前图片加载就绪后，检测下一个图片是否在当前屏 */ next [ 0 ] && render ( next ) ; index ++ ; } ) ; } } }
显示图片
显示图片