Created
May 3, 2012 16:04
-
-
Save nicinabox/2586814 to your computer and use it in GitHub Desktop.
Load image with callback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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