(function (win, undefined) {
var Pagefen = Win.pagefen = function (inforallcount) {
This.nowpage = 1; Current page
This.pagecount = 10; One-time load of 10
How many pages are there in total
This.pageallcount = (inforallcount% This.pagecount = = 0?) (Inforallcount/this.pagecount): (parseint (Inforallcount/this.pagecount) + 1));
};
Previous page method (current page, number of bars displayed per page)
Pagefen.prototype.uppage = function (Nowpage, PageCount) {
This.nowpage-= 1;
This.nowpage = (This.nowpage = = 0? 1:this.nowpage)
Pagecontrol.seach (This.nowpage, This.pagecount);
}
Next Page method
Pagefen.prototype.nextpage = function (Nowpage, PageCount) {
This.nowpage + = 1;
This.nowpage = (This.nowpage = = (This.pageallcount + 1)? this.pageAllcount:this.nowpage);
Pagecontrol.seach (This.nowpage, This.pagecount);
}
} (window));
Query method
var Pagecontrol = {
Seach:function (Nowpage, PageCount) {
var Pagefirst = (nowpage-1) * PageCount + 1; 1 Piece of data
var pageend = nowpage * PageCount; 10 Piece of data
$ ('. Addlistul li '). Hide ();
$ ('. Addlistul li '). Slice (pagefirst-1, pageend). Show ();
}
};
$ (function () {
Here is where to get the data added to UL inside
var ele = $ ('. Addlistul ');
for (var i = 0; i <; i++) {
Ele.append ("<li>" + (i + 1) + "</li>");
}
instantiating pagination
var pagemethod = new Pagefen (100);
Pagecontrol.seach (1, 10);
Previous page modify Current page plus one
$ ('. Have_small '). Click (function () {
Pagemethod.uppage (This.nowpage, This.pagecount);
});
Next page Modify Current page minus one
$ ('. Next_page '). Click (function () {
Pagemethod.nextpage (This.nowpage, This.pagecount);
});
Click on the number to display the first few pages
$ ('. Num '). Click (function () {
var getnumpage = parseint ($ (this). text ());
The currently selected number of pages and then calls the Query method
Pagecontrol.seach (Getnumpage, 10);
Pagemethod.nowpage = Getnumpage;
});
});
<div class= "R-h-3" >
<ul class= "Addlistul" ></ul>
</div>
A small plug-in for paging with prototype