jquery - Trouble using Infinite Scroll with Masonry callback -
i'm trying infinite scroll work masonry on wordpress install, , i'm running problems.
so infinite scroll works, new posts pop under existing posts once navigation div reached. however, can't callback masonry work.
this code i'm using masonry going:
var $container = jquery('.tt'); $container.imagesloaded(function(){ $container.masonry({ itemselector: '.tt_post', columnwidth: 240, gutterwidth: 10 }); }); and i'm using callback:
function(newelements) { // hide new items while loading var $newelems = $(newelements).css({ opacity: 0 }); // ensure images load before adding masonry layout $newelems.imagesloaded(function(){ // show elems they're ready $newelems.animate({ opacity: 1 }); $container.masonry( 'appended', $newelems, true ); }); this can seen @ http://youworkit.co.uk/home/.
the javascript error being thrown 'function statement requires name' @ function(newelements). http://imgur.com/oatjs doing wrong?
it turned out due copy of jquery being loaded overzealous plugin. since has been disabled callback works code:
// hide new items while loading var $newelems = jquery(newelements).css({ opacity: 0 }); // ensure images load before adding masonry layout $newelems.imagesloaded(function(){ // show elems they're ready $newelems.animate({ opacity: 1 }); $container.masonry( 'appended', $newelems, true ); }); hope helps someone.
Comments
Post a Comment