smart-lazyload

1.0.0 • Public • Published

smart-lazyload

An extension that supports lazy loading of image.

Install

Using unpkg CDN

<script src="https://unpkg.com/smart-lazyload/index.js"></script>

Using npm

npm install smart-lazyload --save-dev

Usage

CommonJS usage

const lazyload = require('smart-lazyload')

Call

Image tag demo

<img class="lazyload" src="" data-url="https://test.demo.com/images/test.png"/>

Initialize the extension after image tags are rendered

lazyload.init({
    className: 'lazyload',
    attribute: 'data-url'
})

Method

lazyload.init(options)

  • options => {Object} lazyload options.(required)

Options

  • className => {String} The class name of image tag.(required)
  • attribute => {String} The attribute of data url within image tag.(required)

License

smart-lazyload is MIT licensed.

Package Sidebar

Install

npm i smart-lazyload

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

7.8 kB

Total Files

6

Last publish

Collaborators

  • amoydreamer