An open API service indexing awesome lists of open source software.

https://github.com/midzer/longlist

A Minimalist JavaScript List Pager (ease navigation of long lists)
https://github.com/midzer/longlist

Last synced: about 1 year ago
JSON representation

A Minimalist JavaScript List Pager (ease navigation of long lists)

Awesome Lists containing this project

README

          

# longlist - A Minimalist JavaScript List Pager

Inspired and forked from https://github.com/jekor/longtable and modified for lists.

## Features

* paging in unordered `

    ` and ordered `
      ` lists
      * minimal code
      * controls rendered inside the list in a `` dynamically
      * no library dependencies

      ## How to Use

      ```JavaScript
      var yourList = document.getElementById('yourList');
      longlist(yourList);
      ```

      ## Options

      `longlist()` takes an options argument as an optional second argument. The options are:

      * `perPage`: how many rows to display per page (default: 10)
      * `startPage`: which page to display initially (default: 1)
      * `maxPageLinks`: how many page navigation links to display (default: 9)

      Longlist will display fewer than `maxPageLinks` page navigation links if there are fewer pages. For best results, use an odd numbered `maxPageLinks` greater than equal to 3.

      ```JavaScript
      longlist(yourList, {perPage: 20, maxPageLinks: 7});
      ```

      ## Functions

      * `gotoPage(n)` - jump to the given page number

      ```JavaScript
      yourList.gotoPage(3);
      ```

      ## Events

      * `longlist.pageChange` - triggered when the page changes (passes the page number)

      ## Notes

      * Items to be paged must be children of `

        ` or `
          `.
          * Does not support adding/removing list items.

          ## Unsupported Browsers

          * Internet Explorer <= 9