Getting rid of infinite scroll (at the home page)

Hi!

This is making me a little too crazy.

I’m using Casper and I wanted to remove the Infinite Scroll from the home. I did it, adding this code to default.hbs and following this tips.

    <script>
        document.documentElement.classList.add('no-infinite-scroll');
    </script>

It works because the script now checks for this class at the beginning. Fine!

if (document.documentElement.classList.contains('no-infinite-scroll')) return;

The problema is that, when I get to the bottom of the screen, it loads the rest of the posts, without a click to the next page / load more posts.

What am I missing? :grimacing:

Well, I added this right before the casper.js loading on default.hbs and it seems to have worked…

    {{#is "home"}}
        <script>
            // Disable infinite scroll ONLY on the homepage
            document.documentElement.classList.add('no-infinite-scroll');
        </script>
    {{/is}}