jQuery Pagination pagination plugin
Original project address:
http://plugins.jquery.com/project/pagination
demo instance page
Introduction to plugins
- This jQuery plug-in is an Ajax paging plug-in, which is loaded at one time, so there is no refresh and delay when switching between pages. It is not recommended to use this method if the amount of data is large, because the loading will be slower.
- The CSS of the original plugin is not very reasonable. It uses floating, so it is not convenient to achieve the positioning in the left and right directions, and the floating is not cleared. In the Chinese modified version, I optimized it to support the positioning of text-align.
Instructions
Like other jQuery plugins, this plugin is easy and convenient to use. The way is pagination
, for example$("#page").pagination(100);
parameter
parameter name description parameter valuemaxentries | total number of entries | Required parameter, integer |
items_per_page | Number of items displayed per page | Optional parameter, default is 10 |
num_display_entries | The number of pagination entries displayed in the body part of a continuous pagination | Optional parameter, default is 10 |
current_page | currently selected page | Optional parameter, the default is 0, which means page 1 |
num_edge_entries | The number of items displayed on both sides of the first and last pagination | optional parameter, default is 0 |
link_to | paginated links | String, optional parameter, default is "#" |
prev_text | The text displayed on the "Previous" pagination button | String parameter, optional, default is "Prev" |
next_text | The text displayed on the "Next" pagination button | String parameter, optional, default is "Next" |
ellipse_text | What text is used to indicate the number of pages omitted? | Optional string parameter, default is "..." |
prev_show_always | Whether to show the "previous" pagination button | Boolean, optional parameter, the default is true, that is, the "previous page" button is displayed |
next_show_always | Whether to show the "next page" pagination button | Boolean, optional parameter, the default is true, that is, the "next page" button is displayed |
callback | Callback | No execution effect by default |
Example
For example the following code:
$("#Pagination").pagination(56, { num_edge_entries: 2, num_display_entries: 4, callback: pageselectCallback, items_per_page:1 });
The meaning of this code is: there are 56 (maxentries) list items in total, 2 (num_edge_entries) are displayed on both sides of the first and last pages, 4 (num_display_entries) are displayed on the number of consecutive paging entities, and the callback function is pageselectCallback (callback), each page The displayed list item is 1 (items_per_page).