hello i've been creating themes for a few weeks now, and im trying to get infinite scroll working on this unfinished theme. i'm new to jquery and i don't know why infinite sroll is not working, i have tried other scripts, but the result is they either don't work or the posts overlap on masonry.
here is the code:
$(function(){
var $container = $('#main_container');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.post'
});
});
$container.infinitescroll({
navSelector : "#nav",
nextSelector : "#nav a#next",
itemSelector : '.post', // selector for all items you'll retrieve
loading: {
finishedMsg: '',
}
},
// 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 );
});
});
});
hello i've been creating themes for a few weeks now, and im trying to get infinite scroll working on this unfinished theme. i'm new to jquery and i don't know why infinite sroll is not working, i have tried other scripts, but the result is they either don't work or the posts overlap on masonry. here is the code:
$(function(){ var $container = $('#main_container'); $container.imagesLoaded(function(){ $container.masonry({ itemSelector: '.post' }); }); $container.infinitescroll({ navSelector : "#nav", nextSelector : "#nav a#next", itemSelector : '.post', // selector for all items you'll retrieve loading: { finishedMsg: '', } }, // 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 ); }); }); });any help? :\