分页效果 (后端分页,前端改变参数‘页码’请求数据)
html:
<div style="float: left;margin-right: 30px;" class="tcdPageCode"></div>
JS:
$(".tcdPageCode").createPage({
pageCount://总页数,
current:1,
backFn:function(p){
//p为返回的当前页码
}
});
css:
* {
margin: 0;
padding: 0;
list-style: none;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
.tcdPageCode {
padding: 15px 5px;
text-align: left;
color: #ccc;
text-align: center;
}
.tcdPageCode a {
display: inline-block;
color: #6699cc;
display: inline-block;
height: 25px;
line-height: 25px;
padding: 0 5px;
border: 1px solid #ddd;
margin: 0 2px;
border-radius: 4px;
vertical-align: middle;
}
.tcdPageCode a:hover {
text-decoration: none;
border: 1px solid #6699cc;
}
.tcdPageCode span.current {
font-size: 12px;
display: inline-block;
height: 25px;
line-height: 25px;
padding: 0 5px;
margin: 0 2px;
color: #fff;
background-color: #6699cc;
border: 1px solid #6699cc;
border-radius: 4px;
vertical-align: middle;
}
.tcdPageCode span.disabled {
font-size: 12px;
display: inline-block;
height: 25px;
line-height: 25px;
padding: 0 5px;
margin: 0 2px;
color: #bfbfbf;
background: #f2f2f2;
border: 1px solid #bfbfbf;