I try to use Infinite Scroll(https://infinite-scroll.com/), so I prepared jquery-3.2.1.min.js and infinite-scroll.pkgd.min.js.
Then I made a project that contains js files and PHP files. The file tree is below:
infscroll--index.php
|
-index-2.php
|
-js--
|
-infinite-scroll.pkgd.min.js
|
-jquery-3.2.1.min.js
And file contents are below:
index.php
<html>
<head>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.min.js"></script>
<script>
$('.article-feed').infiniteScroll({
path: '.pagination__next',
append: '.article',
status: '.scroller-status',
hideNav: '.pagination'
});
</script>
</head>
<body>
<div class="article-feed">
<p class="article">1</p>
<p class="article">2</p>
</div>
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips">
</div>
<p class="infinite-scroll-last" style="display: none">End of content</p>
<p class="infinite-scroll-error" style="display: none">No more pages to load</p>
</div>
<p class="pagination">
<a class="pagination__next" href="index-2.php">Next page</a>
</p>
</body>
</html>
index-2.php
<html>
<head>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.min.js"></script>
<script>
$('.article-feed').infiniteScroll({
path: '.pagination__next',
append: '.article',
status: '.scroller-status',
hideNav: '.pagination'
});
</script>
</head>
<body>
<div class="article-feed">
<p class="article">3</p>
<p class="article">4</p>
</div>
<div class="scroller-status">
<div class="infinite-scroll-request loader-ellips">
</div>
<p class="infinite-scroll-last" style="display: none">End of content</p>
<p class="infinite-scroll-error" style="display: none">No more pages to load</p>
</div>
<p class="pagination">
<a class="pagination__next" href="index-3.php">Next page</a>
</p>
</body>
</html>
I thought that the result is like
1
2
3
4
but the actual result is
1
2
Next page<-this is a link to index-2.php
Are there any mistakes? I couldn't understand infinite-scroll so There may be foolish mistakes.