Loads images, background images, scripts, styles, iframes, videos and audios asynchronously (just 241 bytes).
Loads images, background images, scripts, styles, iframes, videos and audios asynchronously (just 241 bytes).
Loads images, background images, scripts, styles, iframes, videos and audios asynchronously. -
nodeList{NodeList} [optional] - A NodeList of elements. By default, it is the result of
querySelectorAll('[data-aload]').
aload();
$ npm install aload$ bower install aload
Note: I recommend to use
aloadinline in your HTML.
As standalone just include
aloadfunction (just 241 bytes) inline into your HTML file:
data-aloadattributes instead of
srcor
hrefin your HTML tags (an image for example):
data-aload- URL of the source.
// Onload window.onload = function () { aload(); };
[data-aload] { background-image: none !important; }
.foo { background: url('http://foobar.com/foobar.png'); }
If you are a front-end developer you must know about Progressive enhancement. Progressive enhancement focuses on the content and it must be showed without JavaScript.
For example, to show images when JavaScript is not enabled you should include the images inside
tag.Install
gulp:
$ npm install gulp -g
Open your terminal and clone
aloadby running:
$ git clone [email protected]:pazguille/aload.git
Go to aload's folder:
$ cd aload
Move to develop branch:
$ git checkout develop
Install its dependencies:
$ npm install
Code, code code!
Send pull requests.
npm run dist: Creates a distribution version of
aload. You should find two files:
./dist/aload.jsand
./dist/aload.min.js.
npm test: Runs mocha tests.
MIT license. Copyright © 2016.