Skip to content

Instantly share code, notes, and snippets.

@mathieu-aubin
Forked from takien/lowsrc.js
Created June 11, 2017 03:46
Show Gist options
  • Save mathieu-aubin/7154f81570c215e55c09fa97b93d4536 to your computer and use it in GitHub Desktop.
Save mathieu-aubin/7154f81570c215e55c09fa97b93d4536 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