Aaron Jorbin is right.That code will definitely work. I am using Infinite scroll masonry.I just added the lines posted by him and it worked.
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]
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 );
addthis.toolbox('.addthis_toolbox');
addthis.counter('.addthis_counter');
addthis.init();
});
});
Thanks Aaron Jorbin.