I am building a pagination plugin and I am having the strangest results.
here is a demo
If you click on the next button (>>) you will be taken to the last page.
But, if you click on the prev button (<<) before you click on the next button you will be taken to the proper page.
Ohh, and if you click on a page number then the next button you will always be taken to the last page.
I’ve been staring at it for a bit now. boggles me.
It’s because this line return a string:
So that string eventually makes it’s way into
current_toand when you writecurrent_to + $options.items_ppyou get a string like1010instead of20.Just change the line to:
Or even better:
JSFiddle