Created
October 29, 2012 18:20
-
-
Save jackie/3975454 to your computer and use it in GitHub Desktop.
new lazyload modifications
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
Network.View.Project.Lazyload = $.Core.View.Entity.extend({ | |
}, // proto | |
{ | |
init : function( lazyload ) { | |
var $images = $("#project-modules img.lazy-load"), | |
images_loaded = 0; | |
$images.lazyload({ | |
placeholder : Config.NETIMAGESURL + "site/grey.png", | |
effect : "fadeIn", | |
effectspeed : 150, | |
threshold : 1500, | |
enabled : lazyload | |
}); | |
$images.on('appear', function() { | |
$images.trigger('countAndShow'); | |
}); | |
$images.on('countAndShow', function() { | |
if( this.loaded && !this.counted ) { | |
this.counted = true; | |
images_loaded++; | |
} | |
if( images_loaded > 4 ) { | |
$images.off('countAndShow'); | |
$images.trigger('appear'); | |
} | |
}); | |
} // init | |
}); // Lazyload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment