[Plugin: Infinite-Scroll] Infinite scroll and Masonry issue
-
Hey there,
I’m trying to get infinite scroll to work with masonry, and I’m running into some problems. I checked the forum for issues related to masonry but I couldn’t get those answers to work. Please help?
So infinite scroll works, new posts just pop under the existing posts. So the callback to masonry doesn’t work.
This is the code I’m using to get Masonry going:
var $container = jQuery('.tt'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.tt_post', columnWidth: 240, gutterWidth: 10 }); });
And this is what I’ve inserted into the callback field in the admin:
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 ); });
This can be seen at https://youworkit.co.uk/home/.
The javascript error this is being thrown is ‘function statement requires a name’ at function(newElements). What am I doing wrong?
https://www.ads-software.com/extend/plugins/infinite-scroll/
- The topic ‘[Plugin: Infinite-Scroll] Infinite scroll and Masonry issue’ is closed to new replies.