Skip to content

Instantly share code, notes, and snippets.

@nicinabox
Created May 3, 2012 16:04
Show Gist options
  • Select an option

  • Save nicinabox/2586814 to your computer and use it in GitHub Desktop.

Select an option

Save nicinabox/2586814 to your computer and use it in GitHub Desktop.
Load image with callback
var loadImage = function($img, callback) {
var image;
image = new Image();
return $img.load(function() {
if (typeof callback === 'function') {
callback(this);
}
return this;
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment