プロジェクト
概要
HTMLImageElement extension for lazy loading.
Web・アプリ開発計測したスター増加
- 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
関連プロジェクトを探す
読み込み中…