I am using perfectmansonry with infinitescroll as follows.
However, on page scroll, page/2 overlaps when I am using perfectmansonry.
Please guide to fix this issue.
Thank you.
Tejas
Code :
var opt = {
layoutMode: 'perfectMasonry',
itemSelector : '.element',
perfectMasonry: {
layout: 'vertical',
liquid: true,
columnWidth: 200, // Force columns to 200px wide
rowHeight: 200, // Force rows to 200px high
}
};
var $container = $('#main');
// Set default isotope
$container.isotope(opt);
//$container.isotope();
$container.infinitescroll({
navSelector : '#page_nav', // selector for the paged navigation
nextSelector : '#page_nav a', // selector for the NEXT link (to page 2)
itemSelector : '.element', // selector for all items you'll retrieve
loading: {
finishedMsg: 'No more pages to load.',
img: 'img/loader.gif'
}
},
// call Isotope as a callback
function( newElements ) {
//console.log(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.append($newElems).isotope( 'appended', $newElems );
});
}
);
I am using perfectmansonry with infinitescroll as follows. However, on page scroll, page/2 overlaps when I am using perfectmansonry. Please guide to fix this issue.
Thank you. Tejas
Code : var opt = { layoutMode: 'perfectMasonry', itemSelector : '.element', perfectMasonry: { layout: 'vertical', liquid: true, columnWidth: 200, // Force columns to 200px wide rowHeight: 200, // Force rows to 200px high }
}; var $container = $('#main'); // Set default isotope $container.isotope(opt); //$container.isotope(); $container.infinitescroll({ navSelector : '#page_nav', // selector for the paged navigation nextSelector : '#page_nav a', // selector for the NEXT link (to page 2) itemSelector : '.element', // selector for all items you'll retrieve loading: { finishedMsg: 'No more pages to load.', img: 'img/loader.gif' } }, // call Isotope as a callback function( newElements ) { //console.log(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.append($newElems).isotope( 'appended', $newElems );
});
} );