Security News
The Unpaid Backbone of Open Source: Solo Maintainers Face Increasing Security Demands
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Double Lazy Load for videos, images and background images.
Right here. Also provides some tips on how to use.
npm install dll.js
new dll('selector',callback);
data-src
, orbackgroundImage
to elements other than <img>
if they have data-src
attribute.<video>
elements having <source>
with data-src
attributedata-src
attribute.Any valid selector or no selector.
// lazy loads an element with a given class and it's children if any have data-src
new dll('.uniqueClassName', callBack);
// lazy loads an element with a given ID and it's children if any have data-src
new dll('#uniqueID', callBack);
// lazy loads any items with data-src from the entire page
new dll();
If you want to lazy load on scroll, with elementInViewport you can do:
// your target element
var el = document.getElementById('myItem');
// the callback
function callback(){
//do some stuff when loading finished
}
// the scroll eventHandler
function scrollHandler(){
if ( elementInViewport(el) ){
new dll(el, callback)
}
}
window.addEventListener('scroll', scrollHandler, false);
Lazy load a parent <div id="myElement" data-src="..image.png">
with many elements inside subject to dll.js object:
var el = document.getElementById('myElement'); //this is a parent
new dll(el, callback)
function callback(){
console.log('I just finished lazy loading the last element for #myElement')
}
FAQs
Double Lazy Load for Images, Videos and Background Images.
The npm package dll.js receives a total of 11 weekly downloads. As such, dll.js popularity was classified as not popular.
We found that dll.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Solo open source maintainers face burnout and security challenges, with 60% unpaid and 60% considering quitting.
Security News
License exceptions modify the terms of open source licenses, impacting how software can be used, modified, and distributed. Developers should be aware of the legal implications of these exceptions.
Security News
A developer is accusing Tencent of violating the GPL by modifying a Python utility and changing its license to BSD, highlighting the importance of copyleft compliance.