Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some bug about startPage #163

Open
ranlix opened this issue Sep 18, 2017 · 1 comment
Open

Some bug about startPage #163

ranlix opened this issue Sep 18, 2017 · 1 comment

Comments

@ranlix
Copy link

ranlix commented Sep 18, 2017

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
Copy link
Owner

In what cases could these variables be different type?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants