Created
September 30, 2013 14:16
-
-
Save billerickson/6764477 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
jQuery(document).ready(function($) { | |
var $container = $('.content'); | |
$container.masonry({ | |
// options | |
itemSelector : '.entry', | |
}); | |
$container.infinitescroll({ | |
navSelector : '.navigation', // selector for the paged navigation | |
nextSelector : '.navigation a', // selector for the NEXT link (to page 2) | |
itemSelector : '.entry', // selector for all items you'll retrieve | |
loading: { | |
finishedMsg: 'No more pages to load.', | |
img: 'http://i.imgur.com/6RMhx.gif' | |
} | |
}, | |
// trigger Masonry as a callback | |
function( newElements ) { | |
// hide new items while they are loading | |
var $newElems = $( newElements ).css({ opacity: 0 }); | |
// ensure that images load before adding to masonry layout | |
$newElems.imagesLoaded(function(){ | |
// show elems now they're ready | |
$newElems.animate({ opacity: 1 }); | |
$container.masonry( 'appended', $newElems, true ); | |
}); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment