原生视频图片懒加载,3kb轻量级插件
video img lazyload size 3kb
reference
By cdn
<script src="http://aerwen.net/prod-api/cdn/lazyload.min.js"></script>
Download
http://aerwen.net/prod-api/cdn/lazyload.min.js
Right mouse button save
鼠标右键另存为
Alternatively, after npm install lazyload-hyw, enter the minifier file to download and take lazyload.min.js to use
或者npm install lazyload-hyw 之后进入minifier文件下载拿出lazyload.min.js即可使用
Options
createLazyLoad:
first arg 1、root el default: document
根节点 默认值为document,
second arg 2、options no default
1、String loading: loading img/video src
加载图片/视频占位图 字符串类型
2、String error:error img src
加载图片失败占位图
3、Number payload:area of loading
加载区域占位图
see a example
<div class="img-box">
<img lazyload="http://localhost:666/images/1.png" class="img-item" alt="">
</div>
<div class="video-box">
<video lazyload="http://localhost:666/video/1.mp4" class="img-item" controls></video>
</div>
//cdn:
<script src="http://aerwen.net/prod-api/cdn/lazyload.min.js"></script>
//file:
<script src="lazyload.min.js"></script>
<script>
createLazyLoad({
error:'../error.jpg',
loading:'../loading.gif',
payload:1.3
})
</script>
本包将一直维护与更新,如果有需求,交流等请加vx:chibawangc