1.下载地址https://esimakin.github.io/twbs-pagination
2.使用
1.引入文件
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
<script src="../js/framework/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/framework/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/framework/jquery.twbsPagination.min.js" type="text/javascript" charset="utf-8"></script>
2.定义一个容器
<ul id="monitor-manage-pagination" class="monitor-manage-pagination"></ul>
3.在js中初始化
$('#monitor-manage-pagination').twbsPagination({
totalPages: data.results.totalPages,
currentPage: pageNum,
hideOnlyOnePage: true,
load_first_page:true,
visiblePages: 5,
first: "首页",
prev: "上一页",
next: "下一页",
last: "尾页",
onPageClick: function (event, page) {
// 在这里写分页的点击事件,上面的page就是你点击的页码
}
});
分页容器.png
页码效果1.png
页码效果2.png
页码效果3.png
网友评论