1.0.0 • Published 3 years ago

@cany/lazyload v1.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
3 years ago

lazyload

Lazy load resource like image or video

Install

npm install --save @cany/lazyload
# or
yarn add @cany/lazyload

CDN

<script src="https://unpkg.com/@cany/lazyload"></script>

Example

<img src="loading.gif" data-url="real-image-url" class="lazy" />
<video data-url="real-video-url" class="lazy"></video>
import Lazyload from '@cany/lazyload'

document.addEventListener('DOMContentLoaded', () => {
  Lazyload.listen('.lazy')
})

API

  • Lazyload.listen(selector | NodeList)

    Listen to elements. which returns a function that can unlisten to elements.

License

MIT

1.0.0

3 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.3

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago