$(function(){ var container = $('ul#posts'); container.imagesLoaded( function(){ container.masonry({ itemSelector : 'li.post' }); }); container.infinitescroll({ navSelector : 'div.pagination', nextSelector : 'div.pagination a#next', itemSelector : 'li.post', }, function( newElements ) { var $newElems = $( newElements ).css({ opacity: 0 }); $newElems.imagesLoaded(function(){ $newElems.animate({ opacity: 1 }); container.masonry( 'appended', $newElems, true ); }); } ); });