Infinite Scroll
Automatically add next page
See infinite-scroll.com for complete docs and demos.
Install
Download
CDN
Link directly to Infinite Scroll files on unpkg.
<script src="https://unpkg.com/infinite-scroll@5/dist/infinite-scroll.pkgd.min.js"></script>
<script src="https://unpkg.com/infinite-scroll@5/dist/infinite-scroll.pkgd.js"></script>
Package managers
npm: npm install infinite-scroll
Yarn: yarn add infinite-scroll
License
Infinite Scroll v5 is licensed under the MIT License.
Whereas earlier versions of Infinite Scroll were previously dual licensed for commercial and closed-source usage, Infinite Scroll v5 licensing no longer has this distinction. You are free to use Infinite Scroll v5 in commercial and closed-source applications.
Usage
Infinite Scroll works on a container element with its child item elements
<div class="container">
<article class="post">...</article>
<article class="post">...</article>
<article class="post">...</article>
...
</div>
Options
let infScroll = new InfiniteScroll( '.container', {
path: undefined,
append: undefined,
checkLastPage: true,
prefill: false,
responseBody: 'text',
domParseResponse: true,
fetchOptions: undefined,
outlayer: false,
scrollThreshold: 400,
elementScroll: false,
loadOnScroll: true,
history: 'replace',
historyTitle: true,
hideNav: undefined,
status: undefined,
button: undefined,
onInit: undefined,
debug: false,
})
Browser support
Infinite Scroll v4 supports Chrome 60+, Edge 79+, Firefox 55+, Safari 11+.
For IE10 and Android 4 support, try Infinite Scroll v3.
Development
This package is developed with Node.js v14 and npm v6. Manage Node and npm version with nvm.
nvm use
Install dependencies
npm install
Lint
npm run lint
Run tests
npm test
By Metafizzy 🌈🐻