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

jquery-scrollpaging

v1.1.0

Published

Easy jQuery plugin for scroll pagination(infinite scroll)

Readme

jQuery.scrollPaging: A Powerful Infinite Scroll & Scroll Pagination Plugin

Version GitHub license    GitHub stars    GitHub forks    GitHub watchers    GitHub followers Hire Me jQuery

jQuery.scrollPaging is a lightweight, flexible, and powerful jQuery plugin for implementing infinite scroll (also known as endless scrolling, lazy loading, or scroll pagination). It automatically loads and appends content from a server via AJAX as the user scrolls down the page, creating a seamless and dynamic user experience.

This plugin is highly customizable, supports multiple scroll directions, and includes a rich set of callbacks, making it a perfect solution for blogs, galleries, social media feeds, product listings, and any project requiring dynamic content loading.

Live Demo

Demo 1     Demo 2     Demo 3     Demo 4     Demo 5

jQuery.scrollPaging


Key Features

  • Seamless Infinite Scroll: Automatically fetches and displays content as users scroll, eliminating the need for traditional pagination.
  • Multi-Directional Support: Works with vertical, horizontal, and both scroll directions. You can also specify single directions like up, down, left, or right.
  • SEO-Friendly URL Updates: Optionally updates the browser URL and page title using the History API (pushState) as new content loads, ensuring pages are bookmarkable and shareable.
  • Flexible Paging System: Supports both standard numeric pagination and custom page lists (e.g., ['news', 'updates', 'archive']).
  • Highly Customizable: Offers a wide range of options to control scroll sensitivity, AJAX requests, and behavior.
  • Extensive Callbacks & Events: Provides a full suite of callbacks (onStart, onSuccess, onError, onComplete, etc.) to hook into every stage of the loading process.
  • Lightweight & Efficient: Minimal footprint with optimized performance to ensure smooth scrolling.
  • Cross-Browser Compatible: Works reliably across all modern web browsers.

Installation & Usage

Getting started with jQuery.scrollPaging is simple.

1. Include Files

First, make sure you have jQuery included in your project. Then, include the jquery.scrollpaging.min.js file.

<!-- 1. Include jQuery (requires version 1.7+) -->
<script src="[https://code.jquery.com/jquery-3.7.0.min.js](https://code.jquery.com/jquery-3.7.0.min.js)"></script>

<!-- 2. Include the jQuery.scrollPaging plugin -->
<script src="path/to/jquery.scrollpaging.min.js"></script>

2. HTML Structure

Create a container for your content. The plugin will append new items into this container.

<div id="content-container">
    <!-- Initial content goes here -->
    <div class="post">...</div>
    <div class="post">...</div>
</div>

3. Initialize the Plugin

Call the .scrollPaging() method on the scrollable element (e.g., window for page scrolling or a specific div for an overflow container).

$(document).ready(function() {
    // Apply scrollPaging to the window for a typical page scroll
    $(window).scrollPaging({
        // The URL to fetch new content from.
        // 'scrollPaging' is a placeholder that will be replaced by the page number.
        requestURL: '/api/posts?page=scrollPaging',
        
        // The selector for the element where new content will be appended.
        target: '#content-container', 
        
        // The starting page number.
        currentPage: 1, 
        
        // The last page number to prevent further requests.
        maxPage: 20,
        
        // Update the browser's URL as the user scrolls.
        affectURL: true, 
        
        // Callback function after content is successfully loaded.
        onSuccess: function(event, direction, isPositive, page, requestURL, response) {
            console.log('Successfully loaded page ' + page);
            // You can perform additional actions here, like re-initializing
            // other plugins on the newly loaded content.
        }
    });
});

Configuration Options

Customize the plugin's behavior with the following options:

| Option | Type | Default | Description | | :--- | :--- | :--- | :--- | | requestURL | String | location.href with ?page=scrollPaging | The URL to send the AJAX request to. Use the string scrollPaging as a placeholder for the page number/value. | | showURL | String | Same as requestURL | The URL to display in the browser's address bar if affectURL is true. | | target | String | null | A jQuery selector for the container where the loaded content will be prepended or appended. | | direction | String | 'vertical' | The scroll direction to monitor. Can be vertical, horizontal, both, up, down, left, or right. | | amount | Number | 128 | The pixel distance from the edge of the scroll area that triggers the content loading. | | currentPage | Number/String | 1 or parsed from URL | The initial page number or value. | | minPage | Number/String | 1 | The minimum page number. Scrolling up will stop requests at this page. | | maxPage | Number/String | 100 | The maximum page number. Scrolling down will stop requests at this page. | | pageList | Array/String | null | An array or comma-separated string of custom page values (e.g., ['home', 'about', 'contact']). If used, minPage and maxPage should be values from this list. | | affectURL | Boolean | false | If true, updates the browser URL using the History API. | | affectTitle | Boolean | false | If true, updates the document title. Requires affectURL to be true. | | requestTitle| String | document.title| The new document title to use. scrollPaging can be used as a placeholder. | | ajax | Object | { type: 'GET', async: true } | An object of settings to be passed directly to jQuery's $.ajax() method. |


Callbacks & Events

The plugin provides a rich set of callbacks to give you full control over the loading process.

| Callback | Parameters | Description | | :--- | :--- | :--- | | onScroll | event, direction, isPositive, isLoading, options | Fired on every scroll event within the element. | | onRepeat | event, direction, isPositive, currentPage, options | Fired if a scroll trigger occurs while a request is already in progress. | | onBefore | event, direction, isPositive, nextPage, isNewPage, options | Fired just before a new page request is prepared. | | onStart | event, direction, isPositive, nextPage, options | Fired just before the AJAX request is sent. | | onSuccess | event, direction, isPositive, page, url, response, status, xhr, options | Fired after a successful AJAX request. | | onError | event, direction, isPositive, page, url, xhr, status, error, options | Fired if the AJAX request fails. | | onComplete | event, direction, isPositive, page, url, responseOrXhr, status, xhrOrError, options | Fired after the AJAX request completes (whether success or error). | | onBlank | event, direction, isPositive, page, url, options | Fired if the AJAX request succeeds but returns a blank response. | | onMinPage | event, direction, isPositive, page, options | Fired when the minPage is reached and loaded. | | onMaxPage | event, direction, isPositive, page, options | Fired when the maxPage is reached and loaded. |


License

This plugin is licensed under the MIT License. Copyright (c) 2022 by Mamedul Islam.

See the LICENSE file for more details.


👨‍💻 Author & Hire Me

This plugin was created and is maintained by Mamedul Islam.

I am a passionate web developer with experience in creating interactive and user-friendly web components. I am currently available for freelance projects or full-time opportunities.

I help businesses grow their online presence with custom web solutions. Specializing in WordPress, WooCommerce, and Shopify, I build modern, responsive, and high-performance websites.

Hire Me


⭐ Show Your Support

If you find this extension useful, please consider giving it a star on GitHub! Your support helps motivate further development and improvements.

GitHub stars  

If you found this project helpful, give it a ⭐ on GitHub!