Created
November 13, 2013 04:20
-
-
Save 6r1d/7443641 to your computer and use it in GitHub Desktop.
Centered pagination cases
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case (position - radius > first_page && position + radius <= last_page): | |
pages = range_gen(position - radius, position + radius + 1, position); | |
break; | |
// - page is located near the left corner | |
case (position >= first_page && position <= first_page + radius): | |
pages = range_gen(first_page, first_page + (radius * 2) + 1, position); | |
break; | |
// - page is located near the right corner | |
case (position >= last_page - radius && position <= last_page): | |
pages = range_gen(last_page - (radius * 2), last_page + 1, position); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment