0.1.2 • Published 6 years ago

infinity-scroll v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

infinity-scroll

npm.io npm.io npm.io

infinity-scroll is a JavaScript library that allows you to use infinity scrolling on your website.

Installation

Using npm and webpack

npm install --save infinity-scroll
import InfinityScroll from 'infinity-scroll';

Using jsDelivr

  1. Before your closing </body> tag add:
<script src="//cdn.jsdelivr.net/npm/infinity-scroll@0.1.2/dist/infinity-scroll.min.js"></script>

Manual installation

  1. Download the latest version from the GitHub releases page and extract it somewhere in your project directory.
  2. Then, before your closing </body> tag add:
<script src="infinity-scroll/dist/infinity-scroll.js"></script>

Notice for Internet Explorer users

Additionally you need babel-polyfill and whatwg-fetch installed.

Usage

var infinityScroll = new InfinityScroll({
    selector: '.posts',
    url: page => `/posts/${page}`
    // ...
});

Options

OptionTypeDefaultDescription
selectorstring.infinity-scrollThe selector for the container, containing the infinity scrolling items
thresholdnumber200If the pixels to the page bottom are less than this, the load of the next page will be triggered
urlfunction-A function which takes the current page number and returns the page's url as string
onUpdatefunction-Function which is called, after a page was loaded

Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

0.1.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago