Make sure you are running the page from http// address, infinite scroll will not work if you are running it from you local files. I set up a local environment using node, npm and express that looks like this ...
var express = require("express");
var PORT = 8080;
var app = express();
app.use(express.static("public"))
app.listen(PORT, function(){
console.log("App listening on PORT: " + PORT)
})
So my folder structure looks like this
.
├── node_modules
│
├── public
│ |── page1.html
│ |__ page2.html
│ |__ page3.html
│
├── server.js
│
Each section you want to load has to be its own .html file.
So the body page1.html would look like this. I changed your code to include
a div inside of the container to hold the posts and gave the data-infinite-scroll attribute to the div .posts-feed. Then I moved this
<div class="scroller-status">
<div class="loader-ellips infinite-scroll-request">
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
</div>
<p class="scroller-status__message infinite-scroll-last">End of content</p>
<p class="scroller-status__message infinite-scroll-error">No more pages to load</p>
</div>
<p class="pagination">
<a class="pagination__next" href="page2.html">Next page</a>
</p>
To be inside of container.
<body>
<div class="main">
<div class="container" >
<div class ="posts-feed" data-infinite-scroll='{ "path": ".pagination__next", "append": ".post", "status": ".scroller-status", "hideNav": ".pagination"}' >
<article class="post">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In hendrerit in sem eu elementum. Nam sagittis eleifend aliquam. Cras viverra, sapien vel auctor viverra, augue leo commodo ipsum, id euismod elit nisl id felis. Integer vitae mauris est. Cras vitae varius tortor. Nullam tristique ullamcorper imperdiet. Suspendisse potenti. Donec in elit felis. Donec eget nunc porttitor, lobortis lectus id, sagittis urna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Etiam vitae ornare purus. Sed augue purus, cursus in malesuada non, interdum molestie massa. In interdum nisi at purus gravida rutrum. Praesent finibus lacus ac imperdiet tincidunt.</p>
<p><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br></p>
</article>
</div>
<div class="scroller-status">
<div class="loader-ellips infinite-scroll-request">
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
<span class="loader-ellips__dot"></span>
</div>
<p class="scroller-status__message infinite-scroll-last">End of content</p>
<p class="scroller-status__message infinite-scroll-error">No more pages to load</p>
</div>
<p class="pagination">
<a class="pagination__next" href="page2.html">Next page</a>
</p>
</div>
</div>
</body>
Notice how at the end there is a piece that looks like this
<p class="pagination">
<a class="pagination__next" href="page2.html">Next page</a>
</p>
This is telling infinite scroll what to load next in href. This here will then load the contents from a separate file called page2.html
Then one page2.html that same section should read
<p class="pagination">
<a class="pagination__next" href="page3.html">Next page</a>
</p>
so that page3.html contents are loaded.
Next page
` – Alvaro Castelan Oct 19 '18 at 17:31