Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jade + Bootstrap Pagination Mixin
//- 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
@mehdiq6

This comment has been minimized.

Copy link

commented Aug 14, 2018

oO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.