Html
    Css
    Js

    
                        
 html,body {
	padding:0;
	margin:0;
}
p {
	padding:0;
	margin:0;
}
#page {
	width:460px;
	margin:10px auto;
}
.Paging {
	overflow:hidden;
	width:100%;
}
.Paging-item {
	float:left;
	cursor:pointer;
	padding:5px 10px;
	background-color:rgb(250,250,250);
	color:rgb(51,51,51);
	border:1px solid rgb(221,221,221);
	margin-left:-1px;
	text-decoration:none;
	text-decoration:none;
	font-size:14px;
}
.Paging a.Paging-item:first-child {
	margin-left:0;
}
.Paging-item-active {
	padding:5px 10px;
	background-color:rgb(56,142,60);
	color:rgb(255,255,255);
	border:1px solid rgb(221,221,221);
	margin-left:-1px;
	text-decoration:none;
	pointer-events:none;
	/*不可点击*/
}

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

原生js分页

更新时间:2019-09-05 15:54:36

初始化调用部分为:

初始化调用

new paging('page', {
    curpage: 1, //当前页(默认1)        
    count: 22, //总数据      
    size: 10, //页码尺寸(默认10)        
    showsize: 6, //最多可显示的页面(默认5)       
    callback: function(curpage, totalcount, isfirst) {
        console.log('当前页:' + curpage); //         
        console.log('总页:' + totalcount);
        //首次不执行           
        if (!isfirst) {
            //do something //             
            console.log(curpage);
        }
    }
});
0