Infinite scroll with button without JQuery

Casper theme uses excellent infinitescroll.js script written in pure javascript. Has anyone tried to rewrite it so that instead of scrolling the page for loading posts, a click on the Load More button is used. There are many jQuery solutions, but I would like to use pure JS. Maybe someone is already using some JS plugin on their blog with load more button?

1 Like

I have! Here’s the code. The blog parts of my theme are based on and modified a bit, so you might have to tweak the selectors to make it work with Casper.

1 Like

Your code is throwing a bunch of errors. Not sure if I understand this code and can read

The code uses relatively modern javascript which jshint is not able to fully understand. You should still be able to run the code in Chrome / Firefox (not sure about Safari) without any transpilation. If you’re targeting an older browser, you need to enable transpilation.

Oh yeah. Works great. thanks