Skip to content

Instantly share code, notes, and snippets.

@jackie
Created October 29, 2012 19:26
Show Gist options
  • Save jackie/3975932 to your computer and use it in GitHub Desktop.
Save jackie/3975932 to your computer and use it in GitHub Desktop.
lazyload
Network.View.Project.Lazyload = $.Core.View.Entity.extend({
}, // proto
{
init : function( lazyload ) {
var $images = $('#project-modules img'),
$lazy_images = $images.filter('.lazy-load');
$lazy_images.lazyload({
placeholder : Config.NETIMAGESURL + "site/grey.png",
effect : "fadeIn",
effectspeed : 150,
threshold : $images.length >= 6 ? $images.get(5).height + $images.get(6).height : 0,
enabled : lazyload
});
if( $lazy_images.length ) {
$lazy_images.first().on('appear', function() {
$lazy_images.trigger('showAllImages');
});
$lazy_images.on('showAllImages', function() {
$lazy_images.off('showAllImages');
$lazy_images.trigger('appear');
});
} // if $lazy_images.length
} // init
}); // Lazyload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment