Hey everyone,

I'm working on some pagination.  Before I move on to my issue, the
best pagination plugin I've found is John's pager (http://jquery.com/
api/js/pager.js). But it doesn't seem that this is being developed
further, and the only other I've found (http://rikrikrik.com/jquery/
pager, listed on jquery.com) is really only suited to paginating large
amounts of text, and not lists. Is there anything else out there?

So far, John's pager is looking really good but for one problem - it
has no handling for situations with a high number of pages.  So, I'm
trying to break it up - first prev  2 3 4 5 6 ... 10 ... 20 next last
- sort of thing instead of  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
18 19 20 21 22 23 ... etc.

For this I figure I can use gt() and lt() as a start at least to trim
off the edges so to speak, but I can't figure out how to get the index
of the li with the current page (which has a class of 'cur') relative
to the list and not every element in the DOM.  If I could get that,
then I'm guessing I could hide anything greater/less than the current
index plus/minus 5 for example.

Alternatively, and probably easier, each link in the pagination has a
'rel' attribute numbered sequentially, but I can't seem to get
anything by .attr('rel');

Here's the mark up generated by John's pager (shortened for
simplicity):

<ul class="nav-page">
<li style="display: none;" class="prev"><a href="">« Prev</a></li>
<li class="cur"><a rel="0" href="">1</a></li>
<li class=""><a rel="1" href="">2</a></li>
<li class=""><a rel="2" href="">3</a></li>
<li class=""><a rel="3" href="">4</a></li>
<li class=""><a rel="4" href="">5</a></li>
<li class="next"><a href="">Next »</a></li>
</ul>


Any help greatly appreciated.

Thanks,
Adam

Reply via email to