A Super Small And Ultra-Efficient Library For Lazy Loading | defer.js

🥇 defer.js is a very small and super-efficient library that helps you lazy download almost everything like images, video, audio, iframes, as well as style sheets and JavaScript.

loadinglazy, lazy loading example, lazy loading css, lazy loading images, loading lazy not working, native lazy loading, lazy loading javascript on scroll

⏳ Simple Lazy Loading Of Non-Routable Angular Modules | ngx-loadable

How to make use of it:

Load the minified model of the defer.js library within the doc.

<script src="defer.min.js"></script>

Defer the loading of JavaScript inside the doc. In this instance, the goal script will look forward to 3 seconds to load after the web page is absolutely loaded.

// deferscript(src, id, delay, callback)
deferscript('target.js', 'target-id', 2000, function() {
  // do something
});

Defer the loading of CSS inside the doc.

// deferstyle(src, id, delay)
deferstyle('target.css', 'target-id', 2000);

Lazy load photographs inside the doc.

<img class="demo"
     data-src="target.jpg">
deferimg('demo', 100, 'loaded', function(img) {
  img.onload = function() {
    img.classList.add('show');
  }
});

Lazy load iframes inside the doc. Ideal for Youtube & Vimeo videos.

<iframe class="video"
        data-src="https://www.youtube.com/embed/VIDEO-ID"
>
</iframe>
deferiframe('video', 100, 'loaded', function(frame) {
  frame.onload = function() {
    frame.classList.add('show');
  }
});

Delay The Loading Of Anything, defer.js Plugin/Github


See Demo And Download

 

Official Website(shinsenter): Click Here

This superior jQuery/javascript plugin is developed by shinsenter. For extra Advanced Usages, please go to the official website.

Related Posts

Vector-Graphs-smartGraph

Generating Beautiful Vector Graphs With jQuery | smartGraph

SmartGraph is a free and easy-to-use JavaScript library to create beautiful vector diagrams with many customizations. This plugin allows developers to create dynamic, responsive, draggable vector graphics…

vue-image-slider-transition

Image Slider With 20 Cool Transitions Component | vue-flux

Vue flux is an image slider developed with Vuejs 2 that comes with 20+ nice transitions out of the box. Included transitions 2D transitions Fade: Fades from…

simple-parallax-scrolling

Simple background Image Parallax Scroll Plugin In jQuery

Background parallax effect is a simple jQuery background image without any library. Uses jQuery’s scroll() function to track the scroll event and applies the exact parallax scroll…

bootstrap-color-picker-plugin

Modular Color Picker Plugin for Bootstrap | BS Colorpicker

Bootstrap Colorpicker is a standard color picker plugin for Bootstrap 4. Colorpicker Plugin for Bootstrap 5/4/3 frameworks that allow you to add a color picker to an…

gdpr-iframe-manager-js

GDPR Friendly iFrame Manager In Vanilla JS | iframemanager

IframeMananger is a lightweight JavaScript plug-in that helps you to comply with GDPR by completely removing iframes at first and setting a notice related to that service….

diagonal-slider-anime-js

Diagonal Thumbnails Carousel Slider | Anime.js

Diagonal Slider is a cool mini carousel made with Anime.js JavaScript library. It takes a bunch of pictures and turns them into a circular user interface where…