🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

vue-lazy-picture

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-lazy-picture

Responsive lazy loading vue component with meduim-style blur effect

3.0.7
latest
Source
npm
Version published
Weekly downloads
2
-92.31%
Maintainers
1
Weekly downloads
 
Created
Source

Vue Lazy Picture

Responsive Vue component for Medium-style lazy loading pictures. Uses intersection-observer and stackblur-canvas internally.

Demo

https://codesandbox.io/s/4jp678mw09

Warning! You need to install intersection-observer polyfill separately to support IE and mobile browsers.

Creates sandwich of images in container:

<div class="lazy-picture">
  <img>    // placeholder
  <canvas> // blurred placeholder
  <img>    // full-size image
</div>

Usage

Install by npm:

npm i vue-lazy-picture

Then in your vue app:

// App.vue

<template>
  <div id="app">
    <lazy-picture
      :src="image.src"
      :placeholder="image.ph"
      lazy
     />
  </div>
</template>
<script>
import LazyPicture from 'vue-lazy-picture';

export default {
  name: "app",
  components: {
    LazyPicture
  },
  data() {
    return {
      image: {
        ph: "./images/New_york_times_square-terabass_480@0x.jpg",
        src: "./images/New_york_times_square-terabass_480@1x.jpg",
      },
};
</script>

Props

    containerBgColor: {
			type: String,
			default: "rgb(222, 222, 222)"
		},
		maxWidth: {
			type: String,
			default: "100%"
		},
		containerClass: {
			type: String,
			default: "lazy-picture"
		},
		title: {
			type: String,
			default: "Image"
		},
		placeholder: {
			type: String,
			required: true
		},
		src: {
			type: String,
			required: true
		},
		lazy: {
			type: Boolean,
			default: false
		},
		blurRadius: {
			type: Number,
			default: 5
		},
		transitionDuration: {
			type: Number,
			default: 500
		},
		easing: {
			type: String,
			default: "ease"
		},
		threshold: {
			type: Number,
			default: 0.5
		}

Keywords

vue

FAQs

Package last updated on 12 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts