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@4/dist/infinite-scroll.pkgd.min.js"></script>
<script src="https://unpkg.com/infinite-scroll@4/dist/infinite-scroll.pkgd.js"></script>
Package managers
npm: npm install infinite-scroll
Yarn: yarn add infinite-scroll
License
Commercial license
If you want to use Infinite Scroll to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Purchase an Infinite Scroll Commercial License at infinite-scroll.com
Open source license
If you are creating an open source application under a license compatible with the GNU GPL license v3, you may use Infinite Scroll under the terms of the GPLv3.
Read more about Infinite Scroll's license.
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 🌈🐻