Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Automatically sends ajax requests as the user scrolls an element.
JavaScript PHP
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Assets
Demos
Docs
Source
README.md
package.yml

README.md

LazyPagination

LazyPagination

Automatically sends ajax requests as the user scrolls an element. Provides options to control where the response is injected into the DOM (usually above a footer).

How to use

Set it up just like you would any other pagination on the server. This example is totally simplified.

HTML/PHP Front-page

#HTML
<body>
  <div id="navigation"> <!-- fallback navigation --> </div>

    <?php include '_page.php'; ?>

    <div id="footer">Blah blah blah</div>
</body>

HTML/PHP Requested partial

You would do something on the server to deliver the next page.

#HTML
<div class="page">
    <p>I am a page <?php echo $_GET['page']; ?></p>
</div>

JavaScript

#JS
var lazy = new LazyPagination(document,{
    url: '_page.php',
    method: 'get',
    maxRequests: 20,
    buffer: 1000,
    navigation: 'navigation', // will destroy this if javascript is enabled
    inject: {
        element: 'footer',
        where: 'before' // will inject pages above the footer
    }
});

View the MooDoc for usage and examples.

Something went wrong with that request. Please try again.