jquery的分页
Posted shenbo666
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jquery的分页相关的知识,希望对你有一定的参考价值。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
ul{
list-style: none;
}
.box-footer {
margin-top: 20px;
padding-right: 20px;
}
.box-footer .box {
float: left;
overflow: hidden;
}
.box-footer .box .pagination-wrap {
overflow: hidden;
border-left: 1px solid #dbe0e5;
float: left;
padding-left: 0px;
margin: 0;
}
.box-footer .box .pagination-wrap li {
float: left;
padding: 4px 8px;
cursor: pointer;
border: 1px solid #dbe0e5;
border-left: none;
}
.box-footer .box .pagination-wrap .pagination-current {
background: #337ab7;
color: #fff;
}
.box-footer .box .pagination-btn,
.box-footer .box .pagination-btn2 {
float: left;
padding: 4px 8px;
cursor: pointer;
}
.box-footer .box .pagination-btn2 {
float: right;
}
</style>
</head>
<body>
<div class="box-footer clearfix">
<div class="box" id="wrap1">
<span class="pagination-btn" id="pagination-prev"><</span>
<ul class="pagination-wrap clearfix">
<li class="pagenum pagenum1" data-num="1">1</li>
<li class="pagination-ellipsis">...</li>
<li class="pagenum " data-num="7">7</li>
<li class="pagenum " data-num="8">8</li>
<li class="pagenum pagination-current" data-num="9">9</li>
<li class="pagenum " data-num="10">10</li>
<li class="pagenum " data-num="11">11</li>
<li class="pagination-ellipsis">...</li>
<li class="pagenum" data-num="1890">1890</li>
</ul>
<span class="pagination-btn2" id="pagination-next">></span></div>
</div>
<script src="./lib/jquery/jquery.2.24.js"></script>
<script src="./lib/jquery/pagejquery.js"></script>
<script type="text/javascript">
var onPagechange = function (page) {
console.log(‘当前点击页码‘, page);
}
var obj = {
wrapid: ‘wrap1‘, //页面显示分页器容器id
total: 18891,//总条数
pagesize: 10,//每页显示10条
currentPage: 1,//当前页
onPagechange: onPagechange,
//btnCount:7 页数过多时,显示省略号的边界页码按钮数量,可省略,且值是大于5的奇数
}
pagination.init(obj);
</script>
</body>
</html>
以上是关于jquery的分页的主要内容,如果未能解决你的问题,请参考以下文章