Some bug about startPage
ranlix opened this issue · 1 comments
ranlix commented
getPages: function (currentPage) {
var pages = [];
var half = Math.floor(this.options.visiblePages / 2);
var start = currentPage - half + 1 - this.options.visiblePages % 2;
var end = currentPage + half;
// handle boundary case
if (start <= 0) {
start = 1;
end = this.options.visiblePages;
}
if (end > this.options.totalPages) {
start = this.options.totalPages - this.options.visiblePages + 1;
end = this.options.totalPages;
}
var itPage = start;
while (itPage <= end) {
pages.push(itPage);
itPage++;
}
return {"currentPage": currentPage, "numeric": pages};
},
in below code block, if currentPage and half have different type(int and string), there will be error, same issue exists in "render" method:
if ($this.data('page') === pages.currentPage)
==> if ($this.data('page') === +pages.currentPage)
josecebe commented
In what cases could these variables be different type?