Skip to content

peps84/polite-asset-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Polite Asset Loader

When passed an id, class or any CSS selector this script will add all instances of what is passed to an object. The object will then be looped through and any data-attributes with the key data-src will have it's value copied to the src attribute loading the asset.

How to use

 var pal = require('polite-asset-loader');

Polite loads all elements that share this class:

 pal.load('.class');

Polite loads element with unique id:

 pal.load('#id');

Polite loads the third image tag that is a direct child of body:

 pal.load('body > img:nth-child(3)');

About

A method to polite load heavy weight assets

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published