File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change 1
1
# lazyload
2
- Lazyload Plugin for javaScript
2
+ 图片懒加载插件
3
+
4
+ 具备以下特性
5
+
6
+ - 支持图片 change 前的回调事件
7
+ - 支持设置图片加载时的临界值
8
+ - 兼容性IE7+
9
+
10
+
11
+
12
+ ##Examples
13
+
14
+ ``` html
15
+ <script >
16
+ // 获取目标对象
17
+ var imgArr = document .getElementsByTagName (' img' );
18
+ var box = document .getElementById (' box' );
19
+ // 实例化插件
20
+ new Lazyload (imgArr,{
21
+ container: box,
22
+ apper : function (){
23
+ // some code
24
+ }
25
+ })
26
+ </script >
27
+ ```
28
+ ##主要参数
29
+ ``` js
30
+ /**
31
+ * @param {number} threshold 临界值,选填,默认 0
32
+ * @param {string} event 事件类型,选填,默认 'scroll'
33
+ * @param {object} container 容器,选填,默认 window
34
+ * @param {string} 标记名称,选填,默认 'data-original'
35
+ * @param {function} apper 图片即将更换时的回调函数,选填,默认 null
36
+ * @param {string} placeholder 占位图片,选填,默认为一段图片的 base64值
37
+ **/
38
+ ```
39
+ ##Notes
40
+ - 注意插件接受的参数都为原生 javaScript 对象
You can’t perform that action at this time.
0 commit comments