Created
January 15, 2010 13:54
-
-
Save diago/278074 to your computer and use it in GitHub Desktop.
This file contains 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
(function(){ | |
function loaded(elem){ | |
var elem = $(elem); | |
var images = elem.retrieve('loadingImages', elem.select('img')); | |
var loading = images.find(function(elem){ | |
return !elem.complete; | |
}); | |
if(loading) return loaded.delay(.3, elem); | |
else {elem.fire('images:loaded'); elem.store('loadingImages', undefined);} | |
return elem; | |
}; | |
Element.addMethods({ | |
loaded: loaded | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment