Thanks, that got me on the right track. Just to follow through, I ended up passing a spread variable (number of pages on either side of the current page) to pager.js, and calling this function at the end:
function pageTrim(){ $("li:not(.prev):not(.next)",pager).show(); $("li:not(.prev)",pager).lt(curPage-spread-1).hide(); $("li:not(.next)",pager).gt(curPage+spread+1).hide(); } I could chain the first two lines, but combining lt() and gt() this way is problematic as I don't want what's in between, but what's outside if you see what I mean. The +-1 adjustments keep things even on either side for some reason. So not the prettiest, but gets the job done. I might delve further to try and add some leaps (first... 25...50...100...last). Would be nice to finally have a usable pager out there. On Jul 25, 11:02 pm, "Ganeshji Marwaha" <[EMAIL PROTECTED]> wrote: > Something like this should work to get the index of the li relative to the > list. There could be a shorter way, but u get the idea... > > var liIndex; > $("ul.nav-page li").each(function(i) { > if($(this).is(".curr")) { > liIndex = i; > return; > } > > }); > > -GTG > > On 7/25/07, agent2026 <[EMAIL PROTECTED]> wrote: > > > > > 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