Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azerion/lazyload

Package Overview
Dependencies
Maintainers
4
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azerion/lazyload

A lazyload feature for the Azerion mobile sites

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
4
Weekly downloads
 
Created
Source

A "lazyload" feature images on your site.

This feature will only load the images that are in your viewport. This way you wont bother the user to load in images they may never see.

Getting started

Lets start by installing the package, like most of the other package we will make use of NPM

npm install @orange-games/lazyload --save-dev

Now lets call get the tool in our project.

import Lazyload from '@orange-games/lazyload';

At last let's call the feature!

new lazyload('container', {
    itemClass: 'lazyload',
    multiplier: 2,
    initMultiplier: 1
});

note: the only required parameter here is the container.

To make the feature actually work you might want to provide your elements with a url. Here is an example on how you could do this.

<img
class="lazyload"
src=""
srcset=""
data-src="example.png"
data-srcset="example.png, example@2x.png 2x">

As you can see we pass the class name that we have used as a parameter in the JS bit. We can leave src and srcset empty, as they will be filled in with js when they appear in the viewport. We pass the needed urls with the data-src and data-srcset. The plugin will do the rest.

FAQs

Package last updated on 29 Mar 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc