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)
|
for(var k in defaults)
|
||||||
if(!this.opts[k])
|
if(!this.opts[k])
|
||||||
this.opts[k] = defaults[k];
|
this.opts[k] = defaults[k];
|
||||||
this.paginator = $("<div/>").addClass("pagination");
|
this.paginator = $("<ul/>").addClass("pagination");
|
||||||
this.loadPage(0);
|
this.loadPage(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,11 @@
|
||||||
var pages = parseInt(this.items.length / this.opts.itemsPerPage) + 1;
|
var pages = parseInt(this.items.length / this.opts.itemsPerPage) + 1;
|
||||||
var endcaps = pages > this.opts.maxPages;
|
var endcaps = pages > this.opts.maxPages;
|
||||||
this.paginator.html("");
|
this.paginator.html("");
|
||||||
if(this.items.length < this.opts.itemsPerPage)
|
if (this.items.length < this.opts.itemsPerPage) {
|
||||||
|
this.paginator.css("margin-top", "0");
|
||||||
return;
|
return;
|
||||||
var ul = $("<ul/>").appendTo(this.paginator);
|
}
|
||||||
|
var ul = this.paginator;
|
||||||
var s = p - parseInt(this.opts.maxPages / 2);
|
var s = p - parseInt(this.opts.maxPages / 2);
|
||||||
s = s + this.opts.maxPages < pages ? s : pages - this.opts.maxPages;
|
s = s + this.opts.maxPages < pages ? s : pages - this.opts.maxPages;
|
||||||
s = s < 0 ? 0 : s;
|
s = s < 0 ? 0 : s;
|
||||||
|
|
Loading…
Reference in New Issue