用JavaScript分页 [英] Pagination with JavaScript

查看:121
本文介绍了用JavaScript分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的html代码里面有一些< div class =post> 。我想用javascript对它们进行分页。我怎样才能做到这一点? (我知道我可以通过PHP来实现它,但我只想用JS来实现)

I have html code that have some <div class="post"> inside. I want to paginate them with javascript. How can I do that? (I know I can do it by PHP but I just want to do it with JS)

我的php生成的html看起来像这样:

the html generated by my php looks like that:

    <body>
<div id="content">
<div class="post">
post content
</div>
<div class="post">
</div>
...

</div>

</body>

也许最好使用jquery吗? (我正在使用jquery ajax将html加载到内容中)

Maybe it will be the best to use jquery for that? (I'm using jquery ajax to load html into content allready)

推荐答案

是的,有一个jquery插件可以很好地工作
https://github.com/gbirke/jquery_pagination

yea there is a jquery plugin that works nicely https://github.com/gbirke/jquery_pagination

这篇关于用JavaScript分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆