Forum Moderators: open
<script type="text/javascript">
$(function(){
var $container = $('#catProdContainer');
$container.imagesLoaded(function(){
$container.masonry({
itemSelector: '.productlisting-box',
columnWidth: 113,
bufferPx: 0
});
});
// Infinite Scroll
$container.infinitescroll({
navSelector : '.paginationNav', // selector for the paged navigation
nextSelector : '.paginationNav a.button-productlisting-next:last', // selector for the NEXT link (to page 2)
itemSelector : '.productlisting-box', // selector for all items you'll retrieve
loading: {
finishedMsg: '<div class="thumb-scroll"><i class="icon-thumbs-up"></i></div>',
//img: '/images/ajax-loader.gif',
pixelsFromNavToBottom: 40
},
debug : true
},
// 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 );
});
});
});
</script> [edited by: whoisgregg at 4:02 pm (utc) on Nov 19, 2013]
[edit reason] exemplified links, pls see sticky mail [/edit]
I've found that the after the last page the php script I'm using redirects you with a 301 to another page instead of a 404 so the infinite scroll script has no way of knowing it's on the last page.
Is there a way I could check the response first then kill the script if it's 301? Or is there another way to solve this?