Skip to content

Instantly share code, notes, and snippets.

@jbonney
Created June 12, 2013 07:19
Show Gist options
  • Select an option

  • Save jbonney/5763407 to your computer and use it in GitHub Desktop.

Select an option

Save jbonney/5763407 to your computer and use it in GitHub Desktop.
Unveil.js: Lazy load images with support for serving high-resolution images to devices with retina displays. http://luis-almeida.github.io/unveil/
$(document).ready(function() {
$("img").unveil();
// Alternatively, load images X pixels before they are displayed
//$("img").unveil(X);
});
<img src="bg.png" data-src="img1.jpg" />
<img src="bg.png" data-src="img2.jpg" data-src-retina="img2-retina.jpg" />
<noscript>
<img src="img1.jpg" />
</noscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment