hi everyone, im sorry for the lazy replying - just been too busy to mess around with it. I tried to create a new version of the infinite loading script that uses variables to parse the appropriate page/post numbers that need editing within, but the original script uses js regular expressions (which is beyond my level of understanding of javascript). Anyhow, i will attempt to remember / explain for the sake of future postings and for my own reference when I no doubt forget what I did 😊
First thing you have to make sure to get right is the layout of your posts within the page. These are referenced at the beginning so if they aren’t referenced / layed out correctly, the script will fail (it took me a while to figure that out).
In my header, I’ve got the following js:
$(document).ready(function(){
$('#posts').infinitescroll({
navSelector : ".navigation",
nextSelector : "a.next",
itemSelector : ".post",
}
});
Note the selectors as these need to match up with the classes on your page. For instance, my page, the navigation (page next / prev buttons) are house in a div with a class called navigation with the next button having a.class of next.
<div class="navigation">
<span></span>
<a href="/index.php/notes/P3class=next">Next Page</a>
</div>
After this is set up, you need to modify some of the stuff in the infinitescroll script itself. Since it’s been a while since I edited it, I don’t entirely remember what I edited (sorry), but I know it pertained to the determinePath(path) along with the kickOffAjax function. specifically, these adjust the number of posts to load next as well as how to handle the last few posts.
In the determinePath function, I changed the numbers (almost all of them) and in the kickOffAjax function, I had to adjust the opts.currentPage part to match. So for instance I changed the determinePath to 3 and then change the opt.currentPage to:
if (opts.currPage == 1) {
opts.currPage = 0;
}
opts.currPage+=3;
...
I have posted my edited infinitescroll.js file so you )hopefully) needn’t sift through that unless you want to load more than 3 posts at a time.
I hope that was helpful. Best of luck!