simplePagination API,simplepagination

來源:互聯網
上載者:User

simplePagination API,simplepagination
simplePagination API

 

simplePagination.js

一個簡單的jQuery分頁外掛程式,主題和Bootstrap支援CSS 3

分頁按鈕樣式

"light-theme" 

 

"dark-theme"

 

"compact-theme"

 

http://www.arungudelli.com/jquery/simple-pagination-using-jquery/

 

使用

Step 1: 添加js和css

<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>

 

<!-- JS -->

<script type="text/javascript" src="plug/simplePagination/tests/lib/jquery.min.js"></script>

<script type="text/javascript" src="plug/simplePagination/jquery.simplePagination.js"></script>

 

<!-- CSS -->

<link type="text/css" rel="stylesheet" href="plug/simplePagination/simplePagination.css"/>

Step 2: 添加js代碼

$(function(){

  $("#paging2").pagination({

          items: 100,

         itemsOnPage: 10,

         cssStyle: 'dark-theme'

     });

});

 

Step 3: 添加樣式

<style type="text/css">

a{text-decoration:none}

.page{margin:30px auto;width:620px}

</style>

Step 4: 添加div

 <!--分頁div-->

<div id="paging2" class="page"></div>

屬性選項

屬性

類型

預設值

備忘

items

Integer

Default: 1

總條數

itemsOnPage

Integer

Default: 1

每頁顯示條數

pages

Integer

Optional

強制設定分頁的固定式頁面數,這將使items和itemsOnPage屬性失效。

displayedPages

Integer

Default: 5

開始隱藏頁碼的頁數,預設5,最小為3

edges

Integer

Default: 2

How many page numbers are visible at the beginning/ending of the pagination.

currentPage

Integer

Default: 1

當前頁

hrefTextPrefix

String

Default: "#page-"

懸停在頁碼時顯示地址的頁碼首碼。http://xxxxx/test.html#首碼-1

hrefTextSuffix

String

Default: empty string

懸停在頁碼時顯示地址的頁碼尾碼。http://xxxxx/test.html#page-1-尾碼

prevText

String

Default: "Prev"

上一頁按鈕顯示文本

nextText

String

Default: "Next"

下一頁按鈕顯示文本

labelMap

Array

Default: empty array

A collection of labels that will be used to render the pagination items, replacing the numbers.

cssStyle

String

Default: "light-theme"

分頁按鈕樣式

selectOnClick

Boolean

Default: true

Set to false if you don't want to select the page immediately after click.

onPageClick(pageNumber, event)

Function

Optional

頁碼點擊事件調用函數,選擇性參數

onInit

Function

Optional

Function to call when the pagination is initialized.

方法

selectPage - 指定一個分頁的頁碼

$(function() { 

   $("#paging2").pagination('selectPage', 3);

});

prevPage - Selects the previous page.

$(function() { 

   $("#paging2").pagination('prevPage');

});

nextPage - Select the next page.

$(function() { 

   $("#paging2").pagination('nextPage');

});

getPagesCount - 返回總頁數

$(function() { 

   $("#paging2").pagination('getPagesCount');

});

 

getCurrentPage - 返回當前的頁面.

$(function() { 

   $(selector).pagination('getCurrentPage');

});

disable - 禁用分頁功能.

$(function() { 

   $("#paging2").pagination('disable');

});

enable - 解禁分頁功能.

$(function() { 

   $("#paging2").pagination('enable');

});

destroy - 將分頁破壞掉

$(function() { 

$("#paging2").pagination('destroy');

});

redraw - 將分頁破壞狀態恢複

$(function() { 

$("#paging2").pagination('redraw');

});

updateItems - 允許動態修改總條數

$(function() { 

   $("#paging2").pagination('updateItems', 100);

});
updateItemsOnPage - 動態修改總條數後恢複指定總條數

$(function() { 

$("#paging2").pagination('updateItemsOnPage',100);

});

drawPage - 將當頁的資料指定到指定頁碼

$(function() { 

$("#paging2").pagination('drawPage', 2);

});




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.