Unveil.js: load images on-the-go with this lightweight version of the Lazy Load plugin
You are probably already familiar with the Lazy Load, a jQuery plugin that loads images outside of viewport (visible part of web page) only when user scrolls to them.
This plugin is very helpful when dealing with long pages and/or a lot of images and makes the pages load faster.
Unveil.js
I found an handy jQuery plugin written by Luís Almeida that does exactly this job with just a few lines of js: Unveil.
(function( $ ) {
$.fn.unveil = function () {
var images = this, loaded, inview;
this.one("unveil", function(){
this.setAttribute( "src", this.getAttribute( "data-src" ) );
this.removeAttribute( "data-src" );
});
function unveil () {
inview = images.filter(function(){
var $e = $(this),
$w = $(window),
wt = $w.scrollTop(),
wb = wt + $w.height(),
et = $e.offset().top,
eb = et + $e.height();
return eb >= wt && et <= wb;
});
loaded = inview.trigger("unveil");
images = images.not( loaded );
}
$(window).scroll(unveil);
unveil();
return this;
};
})( jQuery );
Usage
You just need to include images in this way:
<img data-src="image.jpg" src="loader.gif">
and call the the plugin to load images
$("img").unveil();

Pingback: car locksmith gold coast
Pingback: _1.A#xn-12c8d1a4fxc.sitew.org
Pingback: quick money
Pingback: use this link
Pingback: business card
Pingback: Easy Web Hosting
Pingback: Networking Events Gold Coast
Pingback: Industrial contact adhesive
Pingback: blog link
Pingback: רוצה לבדוק את זה
Pingback: Datafeedr review
Pingback: kombucha in professional medicine
Pingback: geeky sporty watches men
Pingback: muebles de salón
Pingback: karmaloop free shipping codes
Pingback: jill-e bags
Pingback: wordpress themes seo
Pingback: Brisbane truck driving school
Pingback: this website
Pingback: try this
Pingback: quick payday loans
Pingback: Click Here
Pingback: let me watch this
Pingback: kamagra
Pingback: find this
Pingback: Party Services Corona CA
Pingback: go to my blog
Pingback: Era Leopard
Pingback: sxoli xorou
Pingback: click this
Pingback: check it out
Pingback: buy russian phonetic keyboard
Pingback: issakar.com
Pingback: Perdre du poid facilement et rapidement
Pingback: beta sitosterol hair
Pingback: bph treatment
Pingback: get edu backlinks