Jquery 分页取决于视口大小?
jquery 分页是否可以根据视口的大小来限制每页结果的数量?
如果他们要使用单页应用程序,其中页面上的所有元素都需要适合视口,则可能需要这样做。
Is it possible to have jquery pagination that limits the amount of results per page depending on what size the viewport is?
One might require this if they were going for a one page app where all of the elements on the page were required to fit in the viewport..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
鉴于您知道每个结果的高度是多少,以下代码应该为您指明正确的方向:
Given that you know what the height of each result is, the following code should point you in the right direction:
我不确定是否有一个 jQuery 插件可以实现这一点。但是-您可以根据表格高度和表格大小来计算可以显示的页数。行高。这可以用于分页。
I am not sure if there is a jQuery plugin for this. But- You could calculate the number of pages that can be displayed based on the table height & the row height. This can be used for the pagination instead.
当然,尝试在此页面上搜索常见内容并调整浏览器高度、分页页面的大小随着每页搜索结果的减少,将呈指数级增长,这一切都是通过 jQuery 完成的。
Sure, try searching for something common on this page and resize the browsers height, the pagination pages will increase exponentially as the search results per page decrease, all done with jQuery.