19

GitHub - OutThisLife/imgblur: https://www.npmjs.com/package/imgblur

 6 years ago
source link: https://github.com/OutThisLife/imgblur
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

ImgBlur

View Demo

Simple component coupled with a CLI that will lazy load your images w/ a blurry preview.

Install

yarn add imgblur --dev

Usage

The CLI will generate the preview images for you (appended with -tblur):

{
  ...
  "build:img": "imgblur ./static/*"
  ...
}

Then, just use the component with the original path:

<ImgBlur src='/static/sample.jpg' />

The rest is magic. It will lazy load (based on scroll position) with the preview set as the default image to show.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK