mirror of https://github.com/calzoneman/sync.git
Fix paginator
This commit is contained in:
parent
a4260bd25b
commit
2d7b0fe2ac
|
@ -14,7 +14,7 @@
|
|||
for(var k in defaults)
|
||||
if(!this.opts[k])
|
||||
this.opts[k] = defaults[k];
|
||||
this.paginator = $("<div/>").addClass("pagination");
|
||||
this.paginator = $("<ul/>").addClass("pagination");
|
||||
this.loadPage(0);
|
||||
}
|
||||
|
||||
|
@ -22,9 +22,11 @@
|
|||
var pages = parseInt(this.items.length / this.opts.itemsPerPage) + 1;
|
||||
var endcaps = pages > this.opts.maxPages;
|
||||
this.paginator.html("");
|
||||
if(this.items.length < this.opts.itemsPerPage)
|
||||
if (this.items.length < this.opts.itemsPerPage) {
|
||||
this.paginator.css("margin-top", "0");
|
||||
return;
|
||||
var ul = $("<ul/>").appendTo(this.paginator);
|
||||
}
|
||||
var ul = this.paginator;
|
||||
var s = p - parseInt(this.opts.maxPages / 2);
|
||||
s = s + this.opts.maxPages < pages ? s : pages - this.opts.maxPages;
|
||||
s = s < 0 ? 0 : s;
|
||||
|
|
Loading…
Reference in New Issue