LazyPagination 1.2

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).



Details

Author
Ryan Florence
Current version
1.2
GitHub
rpflorence/LazyPagination
Downloads
3580
Category
Interface
Tags
Report
GitHub Issues

Releases


Dependencies

  • core/1.2.4: Request.HTML

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

  1. <body>
  2. <div id="navigation"> <!-- fallback navigation --> </div>
  3. <?php include '_page.php'; ?>
  4. <div id="footer">Blah blah blah</div>
  5. </body>

HTML/PHP Requested partial

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

  1. <div class="page">
  2. <p>I am a page <?php echo $_GET['page']; ?></p>
  3. </div>

JavaScript

  1. var lazy = new LazyPagination(document,{
  2. url: '_page.php',
  3. method: 'get',
  4. maxRequests: 20,
  5. buffer: 1000,
  6. navigation: 'navigation', // will destroy this if javascript is enabled
  7. inject: {
  8. element: 'footer',
  9. where: 'before' // will inject pages above the footer
  10. }
  11. });

View the MooDoc for usage and examples.


Discuss

A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.

Found a bug in this plugin? Please report it this repository's Github Issues.

blog comments powered by Disqus