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)
- Host: GitHub
- URL: https://github.com/midzer/longlist
- Owner: midzer
- License: mit
- Created: 2016-03-09T18:49:59.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-07T08:17:00.000Z (almost 10 years ago)
- Last Synced: 2025-02-13T01:31:04.438Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://midzer.github.io/longlist
- Size: 30.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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