Download
Demo
- Overview
- Documents
User Rating: 0/5 ( 0 votes)
Your Rating:
Keyboard Shortcuts for Pagination is a lightweight plugin that enables keyboard shortcuts for pagination. It supports Numbered links, Previous-Next page links, First-Last page links.
Source: osvaldas.info
1. INCLUDE JS FILES
<script src="keyboard-pagination.js"></script>
2. HTML
<nav class="pagination" role="navigation" aria-label="Pagination"> <ul> <li class="pagination-first"><a href="" title="First page" aria-label="First page">First</a></li> <li class="pagination-prev"><a href="" rel="prev" title="Previous page" aria-label="Previous page">Prev</a></li> <li class="pagination-number pagination-current"><a href="" title="Page 1, current page" aria-label="1, current page">1</a></li> <li class="pagination-number"><a href="" title="Page 2">2</a></li> <li class="pagination-number"><a href="" title="Page 3">3</a></li> <li class="pagination-number"><a href="" title="Page 4">4</a></li> <li class="pagination-number"><a href="" title="Page 5">5</a></li> <li class="pagination-next"><a href="" rel="next" title="Next page" aria-label="Next page">Next</a></li> <li class="pagination-last"><a href="" title="Last page" aria-label="Last page">Last</a></li> </ul> </nav>
3. JAVASCRIPT
keyboardPagination( '.pagination', { num: '.pagination-number', numCurrent: '.pagination-current', prev: '.pagination-prev', next: '.pagination-next', first: '.pagination-first', last: '.pagination-last' });
4. OPTIONS
NAME | DEFAULT VALUE | DESCRIPTION |
---|---|---|
num | false | List items selector for numbered (1, 2, 3, …) page links |
numCurrent | false | Currently active numbered list item selector |
prev | false | List item selector for the previous page link |
next | false | List item selector for the next page link |
first | false | List item selector for the first page link |
last | false | List item selector for the last page link |
doublePressInt | 250 | An interval (delta) in milliseconds between two button presses. Serves as a shortcut forfirst and last, which must be set. The lower the value the faster the button should be pressed two times. |
keyCodeLeft | 37 | Key code for previous page |
keyCodeRight | 39 | Key code for next page |