I would like to add infinite scrolling to a page I have that lists items from a database table. I haven’t found any tutorials that use infinite scrolling on data taken from a database, and most of the others seem to use jQuery.
Can anyone point me in the direction of a decent tutorial?
It seems to take a vanilla JavaScript perspective, walks you through the logic and I think with a little more customization you can make it work for any data you pull from a database.
Infinite scrolling is no different than paging implemented in a slightly different manner. If you’ve ever done a paged approach, then it shouldn’t be that hard to adapt to.
My pagination is all PHP. However, I am making good progress with infinite scroll. The only thing (I think) that I’m stuck with is where to keep track of the offset (or page number). Is it best in a session variable, cookie or somewhere else?
I’ve been reading through the following interesting and very in-depth article (still reading). There is a part that covers handling the offsets using a mock database. The offsets and the chunk data are passed in object format.