I am using the jquery masonry infinite scroll script. The pagination next page is loading repeatedly. How can i stop it? When I scroll the page every time the pagination content is appended repeatedly instead of showing a message like "No more content to load".
$(function(){
// alert($('.pin_item').length);
var $alpha = $('#alpha');
$alpha.masonry({
itemSelector: '.pin_item',
columnWidth: 230,
//isAnimated: true
});
$alpha.infinitescroll({
navSelector : '#page-nav', // selector for the paged navigation
nextSelector : '#page-nav a', // selector for the NEXT link (to page 2)
itemSelector : '.pin_item', // selector for all items you'll retrieve
bufferPx : 50,
loading: {
finishedMsg: 'No more pages to load.',
img: 'http://i.imgur.com/6RMhx.gif'
}
},
// 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 });
$alpha.masonry( 'appended', $newElems, true );
});
});
});