Skip to content

Commit c635bc6

Browse files
author
zhangbo
committed
使用
1 parent f2d7c62 commit c635bc6

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,18 @@
55
* 基于angular 编写的可复用图片懒加载指令
66

77
### 思路
8-
* img的src不要使用真实, 用一个属性保存在元素上
9-
* 把所有需要使用延迟加载的元素放到一个数组中
8+
* 图片的src不要使用真实地址, 用一个属性保存在元素上
9+
* 把所有需要使用延迟加载的图片元素放到一个数组中
1010
* 初始化的时候检查数组中的元素是否在出视范围内 ,可视范围内即加载
11+
* 给window绑定滚动事件来检查图片是否需要加载
1112
* 加载完成的img从列队中删除
1213

14+
### 应用场景
15+
* 当过多的图片还没出现在视野的时候就已经下载,可以使用`angular-imglazyload` 来避免这种无谓的请求提高性能
16+
1317

1418
### 安装
19+
- 项目使用可以直接 `bower install angular-imglazyload` 下载至项目使用 ,学习的同学可参照下面步骤
1520
```
1621
克隆项目到本地
1722
git clone https://github.com/angular-directive/angular-lazyload.git
@@ -40,12 +45,8 @@ gulp serve
4045

4146
###js
4247
```
43-
4448
// 在你的module里添加lazyload依赖就好
4549
var app = angular.module('demo' , ['lazyload']);
46-
app.controller('demoCtro' , function($scope){
47-
48-
}
4950
5051
```
5152
#### Q&A

0 commit comments

Comments
 (0)