文章转载自:http://motyer.cn/Blog/Details/blog2016101515451280
一款JQuery插件——motypagination。该插件简单易用,只需几个参数的设置即可完成所有的效果,当按照如下方式调用时,显示如下图4.10所示:
$("#motypage1").motypagination({ horizontal:false, url:function(index){return"javascript:alert('This is page {0}')".replace("{0}", index);}},5,10);
$("#motypage2").motypagination({ pages_shown:5, url:function(index){return"javascript:alert('This is page {0}')".replace("{0}", index);}},5,10);
参数说明
color:
正常文本颜色。
color string
默认值:"#787d82"
disabled_color:
失效文本颜色。
color string
默认值:"#c8cdd2"
hover_color:
鼠标悬停文本颜色及该项的下边界颜色。
color string
默认值:"#ec1500"
cur_bgcolor:
当前页的背景色。
color string
默认值:"#ec1500"
cur_color:
当前页上的文本颜色。
color string
默认值:"#fff"
hidewhenonlyone:
当只有一项时是否隐藏。
boolean
默认值:true
horizontal:
横向还是竖向,如果是横向,那么将是一字排开,否则将会是一个select
boolean
默认值:true
first:
是否显示首页。
boolean
默认值:true
last:
是否显示尾页。
boolean
默认值:true
prev:
是否显示上一页。
boolean
默认值:true
next:
是否显示下一页。
boolean
默认值:true
first_text:
首页显示文本。
string
默认值:"首页"
last_text:
尾页显示文本。
string
默认值:"尾页"
prev_text:
上一页显示文本。
string
默认值:"上一页"
next_text:
下一页显示文本。
string
默认值:"下一页"
pages_shown:
显示的页面按钮数目,不包括首页、尾页、上一页和下一页,建议设成奇数。
int
默认值:7
url:
页面跳转链接。
function
默认值:function(index){
return "index_" + index;
}
源代码已经托管在github上面了,有兴趣的可以下载看看,也可以帮助完善。
https://github.com/liujian619/MotyPagination