Jade + Bootstrap Pagination Mixin
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
//- Pagination mixin | |
//- ---------------- | |
//- start=# to start pagination at | |
//- numPages=# links to serve up | |
//- base=base url before num | |
//- | |
//- Example: | |
//- pagination(3,5,4,'/fda/') | |
//- Yields: | « | 3 | 4 | 5 | 6 | 7 | » | | |
//- « = /fda/2, 3 = /fda/3, 4 = #, .. 7 = /fda/7, » = /fda/8 | |
mixin pagination(start, numPages, curr, base) | |
- start = start || 1 | |
- numPages = numPages || 10 | |
- curr = curr || 1 | |
- base = base || '#' | |
.pagination | |
ul | |
- if(curr==1) | |
li.disabled | |
a(href='#') Prev | |
- else | |
li | |
a(href='#') Prev | |
- for(var i=start;i<start+numPages;i++) { | |
- if(i==curr) | |
li.active | |
a(href='#{base}#{i}') #{i} | |
- else | |
li | |
a(href='#{base}#{i}') #{i} | |
- } | |
li | |
a(href='#') Next |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oO