https://github.com/pgkk/kkpager javascript
js分页展现控件,传入简单参数就能使用的分页效果控件css
在线测试连接: http://pgkk.github.io/kkpager/example/pager_test.htmlhttp://pgkk.github.io/kkpager/example/pager_test_orange_color.htmlhttp://pgkk.github.io/kkpager/example/pager_test_clickmode.htmlhtml
<script type="text/javascript" src="../lib/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="../src/kkpager.min.js"></script> <link rel="stylesheet" type="text/css" href="../src/kkpager_blue.css" />
<div id="kkpager"></div>
<script type="text/javascript">//生成分页控件 kkpager.generPageHtml({ pno : '${p.pageNo}', mode : 'link', //可选,默认就是link //总页码 total : '${p.totalPage}', //总数据条数 totalRecords : '${p.totalCount}', //连接前部 hrefFormer : '${hrefFormer}', //连接尾部 hrefLatter : '${hrefLatter}', //连接算法 getLink : function(n){ //这里是默认算法,算法适用于好比: //hrefFormer=http://www.xx.com/news/20131212 //hrefLatter=.html //那么首页(第1页)就是http://www.xx.com/news/20131212.html //第2页就是http://www.xx.com/news/20131212_2.html //第n页就是http://www.xx.com/news/20131212_n.html if(n == 1){ return this.hrefFormer + this.hrefLatter; } return this.hrefFormer + '_' + n + this.hrefLatter; }});</script>
getLink 参数须要按须要重写。java
<script type="text/javascript">//生成分页控件 kkpager.generPageHtml({ pno : '${p.pageNo}', mode : 'click', //设置为click模式 //总页码 total : '${p.totalPage}', //总数据条数 totalRecords : '${p.totalCount}', //点击页码、页码输入框跳转、以及首页、下一页等按钮都会调用click //适用于不刷新页面,好比ajax click : function(n){ //这里能够作自已的处理 //... //处理完后能够手动条用selectPage进行页码选中切换 this.selectPage(n); }, //getHref是在click模式下连接算法,通常不须要配置,默认代码以下 getHref : function(n){ return '#'; }});</script>
click 参数须要按须要重写,而getHref通常须要配置。jquery
pno
当前页码git
total
总页码github
totalRecords
总数据条数ajax
pagerid
分页展现控件容器ID字符串
默认值 'kkpager'算法
mode
模式,click或link字符串
默认值 'link'dom
isShowTotalPage
是否显示总页数布尔型
默认值 true
isShowCurrPage
是否显示当前页布尔型
默认值 true
isShowTotalRecords
是否显示总记录数布尔型
默认值 false (当isShowTotalPage
为true
时,此设置无效)
isShowFirstPageBtn
是否显示首页按钮布尔型
默认值 true
isShowLastPageBtn
是否显示尾页按钮布尔型
默认值 true
isShowPrePageBtn
是否显示上一页按钮布尔型
默认值 true
isShowNextPageBtn
是否显示下一页按钮布尔型
默认值 true
isGoPage
是否显示页码跳转输入框布尔型
默认值 true
isWrapedPageBtns
是否用span包裹住页码按钮布尔型
默认值 true
isWrapedInfoTextAndGoPageBtn
是否用span包裹住分页信息和跳转按钮布尔型
默认值 true
hrefFormer
连接前部字符串
默认值 ''
hrefLatter
连接尾部字符串
默认值 ''
lang
语言配置对象,属性配置列表:
firstPageText
首页按钮文本字符串
默认值 '首页'
firstPageTipText
首页按钮提示文本字符串
默认值 '首页'
lastPageText
尾页按钮文本字符串
默认值 '尾页'
lastPageTipText
尾页按钮提示文本字符串
默认值 '尾页'
prePageText
上一页按钮文本字符串
默认值 '上一页'
prePageTipText
上一页按钮提示文本字符串
默认值 '上一页'
nextPageText
下一页按钮文本字符串
默认值 '下一页'
nextPageTipText
下一页提示按钮文本字符串
默认值 '下一页'
totalPageBeforeText
总页数前缀文本字符串
默认值 '共'
totalPageAfterText
总页数后缀文本字符串
默认值 '页'
currPageBeforeText
当前页前缀文本字符串
默认值 '当前第'
currPageAfterText
当前页后缀文本字符串
默认值 '页'
totalInfoSplitStr
分页统计信息部分的分隔符字符串
默认值 '/'
totalRecordsBeforeText
总记录数前缀文本字符串
默认值 '共'
totalRecordsAfterText
总记录数后缀文本字符串
默认值 '条数据'
gopageBeforeText
跳转前缀文本字符串
默认值 '转到'
gopageAfterText
跳转前缀文本字符串
默认值 '页'
gopageButtonOkText
跳转按钮文本字符串
默认值 '肯定'
buttonTipBeforeText
页码按钮提示信息前缀字符串
默认值 '第'
buttonTipAfterText
页码按钮提示信息后缀字符串
默认值 '页'
gopageWrapId
页码跳转dom ID字符串
默认值 'kkpager_gopage_wrap'
gopageButtonId
页码跳转按钮dom ID字符串
默认值 'kkpager_btn_go'
gopageTextboxId
页码输入框dom ID字符串
默认值 'kkpager_btn_go_input'
getLink
连接算法函数(仅适用于mode为link)函数类型
click
自定义事件处理函数(仅适用于mode为click)函数类型
getHref
连接算法函数(仅适用于mode为click)函数类型
selectPage
手动调用此函数选中某个页码//选中第2页码 kkpager.selectPage(2);
//默认连接算法函数,使用时须要按须要重写getLink : function(n){ //这里的算法适用于好比: //hrefFormer=http://www.xx.com/news/20131212 //hrefLatter=.html //那么首页(第1页)就是http://www.xx.com/news/20131212.html //第2页就是http://www.xx.com/news/20131212_2.html //第n页就是http://www.xx.com/news/20131212_n.html if(n == 1){ return this.hrefFormer + this.hrefLatter; } return this.hrefFormer + '_' + n + this.hrefLatter; }