jQuery分页需要指导

时间:2012-11-15 12:24:12

标签: php jquery

您好我正在使用jQuery分页,现在它看起来像

<Prev 1 2 3 4 5 6 7 8 9 10 11 12 Next>

而不是上面我需要类似这样的

<Prev 1 2 3 . . . 11 12 Next>

<Prev 3 4 5 . . . 11 12 Next>

<Prev 5 6 7 . . . 11 12 Next>

最后

<Prev 1 . . . . 10 11 12 Next>

以下是了解情况的相应代码

var PerPage = 15;
var NumberOfItems = 180; //from db
var NumberOfPages = Math.ceil(NumberOfItems / PerPage);

 // to create Prev link
 var NavigationHtml = '<li class="previous"><a href="javascript:previous_history_trades();"><span></span></a></li>';
   var CurrentLink = 0;

 // to create total page numbers link
    while (NumberOfPages > CurrentLink) {
           NavigationHtml += '<li class="history_trades_page_link" longdesc="' + CurrentLink + '"><a href="javascript:go_to_history_trades_page(' + CurrentLink + ')">' + (CurrentLink + 1) + '</a></li>';
            CurrentLink++;

      }
     //to create next link
     NavigationHtml += '<li class="next"><a href="javascript:next_history_trades();"><span></span></a></li>';
      $('#history_trades_page_navigation').html(NavigationHtml);

和html

<div class="pagination pagination-mini-r">
  <ul id='history_trades_page_navigation'>
  </ul>
</div>

我该怎么做?

0 个答案:

没有答案