如何使用jqPagination

请帮帮我,我不知道如何使用jqPagination ( http://beneverard.github.com/jqPagination/ )。 我希望每个页面都有其他内容。 例如,第1页,内容是一个段落,第2页是其他段落。 我不想点击显示/隐藏来显示内容。

谢谢!

是的,我只能假设你有类似的代码:

My first paragraph

My second paragraph

My third paragraph

并且您希望使用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(); } }); });​ 

看看这个工作的jsFiddle示例 ,它演示了如何使用插件来显示和隐藏一系列段落。 当然,这个例子也可以扩展到与其他元素/场景一起使用。

请务必回答这是否解决了您的问题。

我正在使用jPages。 这很好用。

只需给你的页面一个id。 然后放置一个div来获取这些信息。

在你jQuery你可以添加这个:

 $(".holder").jPages({ containerID: "pageDivId", perPage: 3 }); 

持有人是您创建的新div。 而containerId是整个pagediv的id。

你可以在这里查看jPages

Interesting Posts