lazyload-vue

Vue Plugin for vanilla-lazyload
1,230 28
Install
npm install lazyload-vue
Latest Version:0.1.20
Vue:2
License:MIT
Last Updated:Jan 3, 2023
Links: GitHub  ·  npm
Maintainer: apeligrini

lazyload-vue

Vue Plugin for vanilla-lazyload

Build status:

CircleCI

features

  • Simple usage with v-lazy-src
  • Accepts options Vue.use(LazyloadVue, options)
  • Multiple instances
  • Scrolling Panel
  • Multiple scrolling panels
  • Responsive images - img tag with srcset / sizes
  • Responsive images - picture tag
  • Delay load
  • Videos - Tag video
  • Lazy Iframes
  • Lazy Background images with v-lazy-bg

Install

yarn add lazyload-vue

Usage

import LazyloadVue from 'lazyload-vue'

Vue.use(LazyloadVue)

Directive lazy-src example

<template>
  <img v-lazy-src="'http://lorempixel.com/300/300'" />
</template>

Directive lazy-container example

<template>
  <div v-lazy-container class="scrollingPanel">
    <img v-lazy-src="'http://lorempixel.com/300/300'" />
    ... other images
  </div>
</template>
<style>
  .scrollingPanel {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
  }
</style>

Example with options

import LazyloadVue from 'lazyload-vue'

Vue.use(LazyloadVue, {
    instances: {
        root: {
            elements_selector: '.lazy-custom-root'
        },
        webp: {
            elements_selector: '.lazy-webp'
            to_webp: true
        }
    }
})
<template>
  <div>
    <img v-lazy-src="'http://lorempixel.com/300/300'">
    <img v-lazy-src:webp="'http://lorempixel.com/300/300'">
  </div>
</template>

Check options section on documentation: vanilla-lazyload

Development Setup

# Project setup

yarn install

# Compiles and hot-reloads for development

yarn start

# Compiles and minifies for production

yarn build

# Run your tests

yarn test

# Lints and fixes files

yarn lint

# Run your unit tests

yarn test:unit

Related Packages

@nuxt-modules/lazy-load

Lazy load module for Nuxt 3

1,592 28
vue-lazy-renderer

Lazily render Vue.js components for performance.

48,387 1
vue-image-zoomer

Responsive image zoom component for Vue.js 3, that also works on touch devices....

204,302 116
@scayle/nuxt-image-provider

An image provider to handle SCAYLE-specific modifiers

99,945
@enso-ui/directives

Vue directives used across Enso UI packages.

14,926 1

Version History

Version Released Vue License
0.1.20 ^2.5.21 MIT
0.1.14 ^2.5.21 MIT
0.1.10 ^2.5.21 MIT
0.1.9 ^2.5.21 MIT
0.1.8 ^2.5.21 MIT