Casper theme - loading posts on click

Hi team,

what would be the most straightforward way to modify the infinitescroll.js to have it load new posts only when a button is clicked? My thinking is something along these lines:

HTML: <button id=“load-posts”>Load more posts</button>

var loadPosts = document.querySelector("#load-posts");
function onClick() {
loadPosts.addEventListener(“click”, onClick);
// window.addEventListener(“scroll”, onScroll, { passive: true });

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.