Created
December 18, 2009 22:40
-
-
Save fguillen/259820 to your computer and use it in GitHub Desktop.
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
$('.lazy_loading').each(function() { | |
if( !this.complete ){ | |
var image = $(this); | |
var image_original_src = $(this).attr('src'); | |
image.attr({src: '/images/item_image_loading.gif'}); | |
(function() { // New scope hack | |
var _image = image; | |
$(new Image()) | |
.load( function(){ | |
$(this).hide(); | |
_image.attr({src: $(this).attr('src')}); | |
}) | |
.attr({src: image_original_src}); | |
})(); // Execute immediately | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment