🥇 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.