jQuery滚动显示隐藏内容 [英] jQuery scroll show hidden content

查看:125
本文介绍了jQuery滚动显示隐藏内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设为这样,默认情况下,页面上显示6个div元素,当用户滚动到页面底部,另外六个加载?



如果您看到此示例,它有多个div。我只想要最初显示其中6个,每次用户到达页面的底部,我想要加载六个,直到你用完的div。



到目前为止,我已经尝试过使用jQuery无限滚动插件,但它们不适用于我的情况,因为事实上,我拥有的元素的数量是非常有限的! / p>

如何使用jQuery来实现?提前感谢!



编辑



我相信可以设置其余的(除了前6个),并且触发一个函数,当到达页面的底部时加载另外6个。

解决方案

我创建了一个非常快的示例,它不是由工作优化:



http://jsfiddle.net/gRzPF/2/


How do I make it so that by default, 6 div elements are shown on the page, and when a user scrolls to the bottom of the page, six more are loaded?

If you see this example, it has multiple divs. I want only 6 of them to be show initially, and each time the user reaches the bottom of the page, I want six more to be loaded, until you 'run out' of divs.

So far I have tried experimenting with jQuery infinite scroll plugins, but they are not applicable in my case, as in fact the number of elements I have is very finite!

How can this be accomplished using jQuery? Thanks in advance!

EDIT

I believe one could set the rest of the divs to hidden (apart from the first 6), and trigger a function that loads six more when the bottom of the page is reached.

解决方案

I have created a very quick example, it's not optimised by does the job:

http://jsfiddle.net/gRzPF/2/

这篇关于jQuery滚动显示隐藏内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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