npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

infinite-scroll-loading

v1.3.5

Published

Apply infinite scroll to your website or web-app.

Readme

Infinite-Scroll

Apply infinite scroll to your website or web-app.

How to start

  • npm install infinite-scroll-loading --save
  • import the normal or minified version from the dist directory.

How to use

InfiniteScroll(config)

Config

| Key | Type | DefaultValue | DataAttribute | Required | |----------------|-------------------------|-------------------------------|---------------|----------| | container | DOMElement | document.body | null | false | | scrollTarget | DOMElement | this.container | null | false | | url | String | null | data-url | true | | request | Object | {data : "", method : "GET"} | null | false | | request.data | Object or Function | "" | null | false | | request.method | String | "GET" | data-method | false | | loading | DOMString or DOMElement | "<div class="infinite-scroll__loading"> Loading... </div>" | null | false | | moreButton | DOMElement | null | null | false | | margin | Number | 500 | data-margin | false | | onLoad | Function | null | null | false | | onRender | Function | null | null | false |

Docs

  • container: The target element that the infinite scroll should be applied to.
  • scrollTarget: The element on which the scroll listener must be added to. If it is not specified the element will be the container.
  • url: The url that the request must be sent to.
  • request.data: The data to be sent via the request. It must be a single-level key-value Object or a Function returning an Object.
  • request.method: The method of the request. By default it is GET.
  • loading: The loading element. The loading element must have the class infinite-scroll__loading.
  • moreButton: The button that loads the next set of data. If moreButton is specified, the scroll listener will be disabled.
  • margin: The scroll margin on which the request of the next set of data must be sent. The value is in pixels from the bottom of the scrollTop.
  • onLoad: A callback function to be called after the next set of data is acquired. It has the response as its parameter and the context of the function is the container element. By default if the onLoad method is not specified, it gets the response and appends it to the container.
  • onRender: A callback function to be called after the next set of data is rendered.
Methods
  • allDataLoaded: A method to say that all the data is loaded and no requests must be sent anymore.

Usage:

    infiniteScrollInstance.allDataLoaded(true) //to specify that all the data is loaded
    infiniteScrollInstance.allDataLoaded(false) //to specify that all the data is not loaded
  • unbind: A method to unbind the infinite scroll from the container.

Usage:

    infiniteScrollInstance.unbind()

Tricks

If you want to let the infinite scroll know that there are no more items to load and prevent it from sending requests again, you can set x-last-page header on your response from the server or return an empty string as the response.

License

This project is licensed under the MIT License.