页面尾部分页的做法:

一、在写分页的html里写上  <div id=”Pagination” class=”pagination”><!– 这里显示分页 –></div>

二、在头部里引用

<link href=”js/jquery-pagination/pagination.css” rel=”stylesheet” />
<script type=”text/javascript” src=”js/jquery-pagination/jquery.pagination.js”></script>

三、在站点的js文件夹里放置下载好的  jquery-pagination插件

 

四、把下面代码复制到本html页面对于的js文件中

//这是一个非常简单的demo实例,让列表元素分页显示
//回调函数的作用是显示对应分页的列表项内容
//回调函数在用户每次点击分页链接的时候执行
//参数page_index{int整型}表示当前的索引页
var initPagination = function() {
var num_entries = $(“#hiddenresult div.result”).length;
num_entries = 50;
// 创建分页
$(“#Pagination”).pagination(num_entries, {
num_edge_entries: 2, //边缘页数
num_display_entries: 12, //主体页数
callback: pageselectCallback,
prev_text:”上一页”,
next_text:”下一页”,
items_per_page:1 //每页显示1项
});
}();

function pageselectCallback(page_index, jq){
/*var new_content = $(“#hiddenresult div.result:eq(“+page_index+”)”).clone();
$(“#Searchresult”).empty().append(new_content); //装载对应分页的内容*/
return false;
}

版权声明:本文为hsp09原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/hsp09/articles/3535291.html