Skip to content

Instantly share code, notes, and snippets.

@webus
Created September 20, 2013 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save webus/6633968 to your computer and use it in GitHub Desktop.
Save webus/6633968 to your computer and use it in GitHub Desktop.
fine load images with jQuery
//function
jQuery.fn.loadComplete = function (fn) {
return this.each(function () {
if (this.complete || this.readyState == 'complete') {
fn.call(this);
} else {
$(this).load(fn);
}
});
};
//implementation
$('img').loadComplete(function(){
$(this).fadeIn(800);
});
//demo at http://yellloh.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment