polite-asset-loader
v1.0.2
Published
A method to polite load heavy weight assets
Downloads
8
Readme
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)');