Skip to content

Instantly share code, notes, and snippets.

@takien
Created December 24, 2012 17:07
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save takien/4370033 to your computer and use it in GitHub Desktop.
Save takien/4370033 to your computer and use it in GitHub Desktop.
Alternate to lowsrc. usage: <img src="lowres.jpg" data-src="highres.jpg" />
/**
* Laod large image at last.
* requires jQuery
* @author: takien
*/
jQuery(document).ready(function($){
$('img').each(function(){
var hires = $(this).data().src;
if((hires != undefined) && (hires != '')){
$(this).attr('src',hires);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment