Socket
Socket
Sign inDemoInstall

dll.js

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.5.0

dist/dll.js

23

package.json
{
"name": "dll.js",
"version": "1.0.0",
"description": "Double Lazy Load for images and background images.",
"main": "dll.js",
"version": "1.5.0",
"description": "Double Lazy Load for Images, Videos and Background Images.",
"main": "dist/dll.min.js",
"module": "src/dll.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"min": "node build.js"
"build": "npm run build-umd && npm run build-umd-min",
"build-umd": "rollup --environment FORMAT:umd,MIN:false -c",
"build-umd-min": "rollup --environment FORMAT:umd,MIN:true -c"
},

@@ -23,3 +26,3 @@ "repository": {

],
"author": "dnp_theme",
"author": "thednp",
"license": "MIT",

@@ -30,5 +33,13 @@ "bugs": {

"homepage": "https://thednp.github.io/dll.js/",
"dependencies": {
"shorter-js": "^0.0.5"
},
"devDependencies": {
"uglify-js": "^2.7.3"
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-json": "^4.0.3",
"@rollup/plugin-node-resolve": "^7.1.0",
"rollup": "^1.32.1",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-terser": "^5.3.0"
}
}
# Double Lazy Load | dll.js
Double Lazy Load for images, background images and videos.
Double Lazy Load for videos, images and background images.
# CDN
Thanks to jsdelivr, we have CDN link <a href="http://www.jsdelivr.com/#!dll.js">here</a>.
[![NPM Version](https://img.shields.io/npm/v/dll.js.svg?style=flat-square)](https://www.npmjs.com/package/navbar.js)
[![NPM Downloads](https://img.shields.io/npm/dm/dll.js.svg?style=flat-square)](http://npm-stat.com/charts.html?package=dll.js)
[![jsDeliver](https://data.jsdelivr.com/v1/package/npm/dll.js/badge)](https://www.jsdelivr.com/package/npm/dll.js)
# Demo
Right [here](http://thednp.github.io/dll.js/). Also provides some tips on how to use.
# npm

@@ -12,5 +16,2 @@ ```

# Demo
Right <a href="http://thednp.github.io/dll.js/">here</a>
# Base syntax

@@ -22,2 +23,3 @@ ```js

# What it does
* Integrates nicelly into your projects and provides build tools
* Do lazy loading for an element that is subject to lazy load via `data-src`, or

@@ -27,3 +29,3 @@ * Do to all child items of a given element

* Do callback when load event is triggered for one element, or for the last child element of a given parent.
* Do lazy loading for video elements having `<source>` with `data-src` attribute
* Do lazy loading for `<video>` elements having `<source>` with `data-src` attribute
* Do lazy load for all items having <code>data-src</code> attribute.

@@ -44,23 +46,20 @@

# Other examples
If your script is in your site head, you should do this
```js
function loadFunctionExample(){
new dll('[data-src]', myFunction);
}
window.addEventListener('load', loadFunctionExample, false);
```
If you want to lazy load on scroll, with [elementInViewport](https://gist.github.com/vincentorback/9ca8446a4c7c87ce3623) you can do:
```js
function scrollExample(){
var el = document.getElementById('myItem');
if ( elementInViewport(el) ){
new dll(el, callback)
}
function callback(){
//do some stuff when loading finished
}
// your target element
var el = document.getElementById('myItem');
// the callback
function callback(){
//do some stuff when loading finished
}
window.addEventListener('scroll', scrollExample, false);
// the scroll eventHandler
function scrollHandler(){
if ( elementInViewport(el) ){
new dll(el, callback)
}
}
window.addEventListener('scroll', scrollHandler, false);
```

@@ -74,7 +73,7 @@

function callback(){
console.log('I just finished lazy loading the last element for #myElement')
console.log('I just finished lazy loading the last element for #myElement')
}
```
#License
<a href="https://github.com/thednp/dll.js/blob/master/LICENSE">MIT License</a>
# License
[MIT License](https://github.com/thednp/dll.js/blob/master/LICENSE)
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc