🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@ax2/lozad-module

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ax2/lozad-module

Lozad integration for Nuxt

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

lozad-module

npm (scoped with tag) npm Dependencies Code Style

Lozad.js integration for Nuxt

📖 Release Notes

Features

Integrate Lozad.js with your Nuxt project.

Setup

  • Install the module with your favorite package manager.
yarn add @ax2/lozad-module
# Or npm i @ax2/lozad-module
  • Add lozad-module to modules section of nuxt.config.js.
// nuxt.config.js

{
  modules: [
    '@ax2/lozad-module',
 ],
}
  • Configure the module as needed by adding a lozad key to nuxt.config.js.
// nuxt.config.js

{
  lozad: {
    // Module options
  }
}

Options

selector

  • Type: String
  • Default: '.lozad'

Selector which lozad uses to find elements to be lazy-loaded.

observer

  • Type: Object
  • Default: {}

IntersectionObserver options, see lozad options.

polyfill

  • Type: Boolean
  • Default: false

Set to true to enable IntersectionObserver polyfill.

Usage

To enable lazy-loading, you must trigger lozad's observe() method in the mounted() hook of your pages/components that include lazy-loadable content.

<template>
<div>
  <img class="lozad" data-src="https://placekitten.com/200/300" />
</div>
</template>

<script>
export default {
  mounted () {
    this.$lozad.observe();
  },
};
</script>

Development

  • Clone this repository
  • Install dependencies using yarn install or npm install
  • Start development server using npm run dev

License

MIT License

Copyright (c) Ax2 Inc.

FAQs

Package last updated on 03 Jun 2020

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