What the hell?
endlessScroll is just a jQuery plugin which pre-fetches content from a subsequent page and adds it directly to the current page, very similar to infinitScroll. One major difference is that the URL of the "next page" is not computed by magic guess, but by just reading it from the source code. Fancy, isn't it? The second difference is that endlessScroll is less code.
Howto?
Using endlessScroll is very similar to infiniteScroll
$('#articles').endlessScroll({
navSelector: '#nav',
nextSelector: '#nav .next a',
itemSelector: '#articles article'
});
Parameters
- navSelector
- jQuery selector for the paging element. This complete element will be removed from the DOM after initialisation of the plugin is done
- nextSelector
- jQuery selector for the next link's a tag. This is used in the current page for the link to the first subsequent page, but also in all subsequent pages to find their next link
- itemSelector
- jQuery selector to grab the items from the subsequent page
- addParams (optional)
- object with additional parameters to be sent to the server during the request for the next page
Ok, but why another infiniteScroll?
Because i can ;-)
And because i don't like to workaround automagic guessing of the next page link in infiniteScroll. The major problem was that infiniteScroll defines, that if you use the "page"-parameter in your URL for paging purposes, that your first page is page 1 and the second is page 2 and so on. I as a programmer start counting at zero, which means, the first page is page 0 and the second is page 1 and so on. That's why