請幫助我,我不知道如何使用jqPagination(http://beneverard.github.com/jqPagination/)。我會每個頁面都有其他內容。例如,第1頁,內容是一段,第2頁是其他段落。我不希望點擊顯示/隱藏來顯示內容。如何使用jqPagination
謝謝!
請幫助我,我不知道如何使用jqPagination(http://beneverard.github.com/jqPagination/)。我會每個頁面都有其他內容。例如,第1頁,內容是一段,第2頁是其他段落。我不希望點擊顯示/隱藏來顯示內容。如何使用jqPagination
謝謝!
好吧,我只能假設你有類似下面的代碼:
<div class="some-container">
<p>My first paragraph</p>
<p>My second paragraph</p>
<p>My third paragraph</p>
</div>
<div class="pagination">
<a href="#" class="first" data-action="first">«</a>
<a href="#" class="previous" data-action="previous">‹</a>
<input type="text" readonly="readonly" />
<a href="#" class="next" data-action="next">›</a>
<a href="#" class="last" data-action="last">»</a>
</div>
你想顯示使用jqPaginaton /隱藏每個段落的順序,嘗試下面的代碼:
$(document).ready(function() {
// hide all but the first of our paragraphs
$('.some-container p:not(:first)').hide();
$('.pagination').jqPagination({
max_page : $('.some-container p').length,
paged : function(page) {
// a new 'page' has been requested
// hide all paragraphs
$('.some-container p').hide();
// but show the one we want
$($('.some-container p')[page - 1]).show();
}
});
});
看看這個working jsFiddle example,它演示瞭如何使用該插件能夠顯示和隱藏一系列段落。當然,這個例子也可以擴展到與其他元素/場景一起工作。
請務必回覆是否解決了您的問題。
我正在使用jPages。這工作正常。
只要給你的網頁一個ID。並放置一個div低於這個信息。
在你的jQuery你只可以補充一點:
$(".holder").jPages({
containerID: "pageDivId",
perPage: 3
});
持有人是您創建的新的div。 containerId是整個pagediv的id。
您可以檢查jPages here
非常感謝:D – user1506759 2012-07-09 12:58:04
非常歡迎您,任何更多jqPagination問題都會在Stack Overflow上用'jqPagination'標籤發佈,它會出現在我的RSS閱讀器中。 – 2012-07-09 13:36:47
@ BenEverard:是否有可能在jqpagination中使用ajax和php獲取數據? – sqlchild 2014-01-17 11:48:09