npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dload-lazyload

v1.3.7

Published

Srcset Lazyload plugin

Downloads

35

Readme

Dload-lazy-load

Dload is a lazy-load plugin for elements and images. It's easily adjustable and easy in use


Installation

npm i dload-lazyload

In your js.

import dload from 'dload-lazyload';

document.addEventListener('DOMContentLoaded', () => {
  dload();
});

Or with custom settings

import dload from 'dload-lazyload';

document.addEventListener('DOMContentLoaded', () => {
  dload({
    className: 'your-custom-class',
    loadedClass: 'classname-when-in-view',
    singleSource: true,
  });
});

Custom options

| Option | Description | Default Value | Custom value type | | ------------- |:-------------| -------------- | ------------- | | className | Class name of elements that will be lazy loaded | lazy-load | string | | loadedClass | Class name that will be added once in viewport | lazy-loaded | string | | singleSource | Boolean to define a single source instead of multi sources | false | bool |

In your scss.

@import 'dload-lazyload/src/styles/variables';
@import 'dload-lazyload/src/styles/dload-lazyload';

Your HTML markup

Basic multisource markup

<figure 
    class="lazy-load"
    data-srcset='{
        "default":"./assets/img/img.jpg",
        "defaultRetina": "./assets/img/imgRetina.jpg",
      }'
  >

But there are some other images avaiable to. For optimal performance for mobile/tablet we've added a couple more sources, which you can devide by a ,.

In the following example you can see all of the possible options.

<figure
    class="lazy-load"
    data-srcset='{
      "base": "https://example.com/dir/to/img/folder/",
      "default": "image1.jpg",
      "defaultRetina": "[email protected]",
      "mobile": "image2.jpg",
      "mobileRetina": "[email protected]",
      "tablet": "image3.jpg",
      "tabletRetina": "[email protected]"
    }'
  >

Basic singleSource markup

<figure 
    class="lazy-load"
    data-srcset='./assets/img/img.jpg'
  >

And now you're ready to go.

Transition classes

For transition classes I've decided to go with reveal.

Example:

<figure 
  class="lazy-load reveal reveal--up"
  data-srcset='{
    "default":"./assets/img/img.jpg",
    "defaultRetina": "./assets/img/imgRetina.jpg",
  }'
>

There are multiple pre made classes for you to use and change.

  • reveal--fade (can be used with any other class)
  • reveal--up (transforms bottom to top)
  • reveal--left (transforms right to left)
  • reveal--right (transforms left to right)

There are some variables that you're able to change: Simply reset the variable to your liking.

  • $dload-transition: cubic-bezier(0.165, 0.84, 0.44, 1) !default;
  • $dload-transition-speed: 600ms !default;
  • $dload-transform-value: 40px !default;
  • $dload-delays: 100 300 600 900 !default;

Delays

If you want delays on your animations you can either set a class like reveal--500. This class is generated by the $delays variable. Simply add or remove values to create extra classes.

Example:

<figure 
  class="lazy-load reveal reveal--up reveal--600"
  data-srcset='{
    "default":"./assets/img/img.jpg",
    "defaultRetina": "./assets/img/imgRetina.jpg",
  }'
>

If you want a random delay you can add the class reveal--random and a random valye between 0 and 500ms will be set on the element

Example:

<figure 
  class="lazy-load reveal reveal--up reveal--random"
  data-srcset='{
    "default":"./assets/img/img.jpg",
    "defaultRetina": "./assets/img/imgRetina.jpg",
  }'
>