infinitescroll is not a function
-
Hey guys,
I tried to use the infinite scroll with masonry on my category page to display all posts. I activated it in my functions.php and my javascript looks like this:
jQuery(function($){ var $container = $('#container'); $container.masonry({ itemSelector: '.grid-item', columnWidth: 450, gutter: 50, }); $container.imagesLoaded(function(){ $container.masonry(); }); $container.infiniteScroll({ navSelector : '#page-nav', // selector for the paged navigation nextSelector : '#page-nav a.next-post', // selector for the NEXT link (to page 2) itemSelector : '.grid-item', // selector for all items you'll retrieve loading: { speed: 0, } }, // 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 ); }); } ); });
The infinite scroll works, but the posts are overlapping. On the console I get this error:
TypeError: $container.infiniteScroll is not a function
I think that’s the reason why the posts are overlapping. Do you have a solution for fixing this bug? Thanks a lot
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘infinitescroll is not a function’ is closed to new replies.