项目
在 GitHub 查看
1000ch/lazyload-image
关于
HTMLImageElement extension for lazy loading.
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文🚩 Finally Native lazy-loading for the web was introduced. I recommend you to use loading attribute instead.
lazyload-image
HTMLImageElement extension for lazy loading. Images will be loaded when they are shown.
Install
Install lazyload-image via npm.
$ npm install lazyload-image
Usage
Import LazyloadImage and register it.
import LazyloadImage from 'https://unpkg.com/lazyload-image';
customElements.define('lazyload-image', LazyloadImage, {
extends: 'img'
});
Modify your <img> elements such as following.
<img
is="lazyload-image"
src="path/to/your/image.jpg"
offset="200px"
width="100"
height="100"
>
Fallback
If a browser does not support customElements.define(), images will be loaded as usual.
License
探索相关项目
加载中…