vue-tiny-lazyload-img

๐ŸŒ A small size Vue.js directive for lazy loading images using IntersectionObserver API
3,437 91
Install
npm install vue-tiny-lazyload-img
Latest Version:0.1.0
Vue:2
License:MIT
Last Updated:May 27, 2021
Links: GitHub  ·  npm
Maintainer: irfan.maulana

๐ŸŒ vue-tiny-lazyload-img

A small size Vue.js directive for lazy loading images using IntersectionObserver API

License version downloads minified

Demo Page

https://mazipan.github.io/vue-tiny-lazyload-img/

Usage

Download

npm install vue-tiny-lazyload-img
// OR
yarn add intersection-observer

Install Plugin

import VueTinyLazyloadImg from 'vue-tiny-lazyload-img'
Vue.use(VueTinyLazyloadImg);

HTML Snippet

<img v-lazyload
  src="https://raw.githubusercontent.com/mazipan/vue-tiny-lazyload-img/HEAD/assets/logo.png"
  data-src="./assets/logo-success.png"
  data-err="./assets/logo-error.png">

Please Use polyfill

This plugin using IntersectionObserver, so please use polyfill if you need support old browser https://github.com/w3c/IntersectionObserver/tree/master/polyfill

$ yarn add intersection-observer

// then add polyfill for IntersectionObserver in your main app
require('intersection-observer')

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# build for production demo with minification
npm run build:demo

# build for plugin distribution file
npm run build:lib

Credit

Based on this awesome article: https://developers.google.com/web/fundamentals/performance/lazy-loading-guidance/images-and-video/


Copyright ยฉ 2018 Built with โค๏ธ by Irfan Maulana

Version History

Version Released Vue License
0.1.0 ^2.6.6 MIT
0.0.3 ^2.5.16 MIT
0.0.2 ^2.5.16 MIT
0.0.1 ^2.5.16 MIT