加载的内容为用户向下滚动加载、内容、用户

2023-09-11 00:37:00 作者:余 生 勿 扰

我建立一个博客页面类型,我想加载项到页面的用户向下滚动,就像谷歌阅读器,或Soup.io.你会如何​​去实现这个效果呢?我看到上面写着的页面的高度,并有一个onScroll甚至贴在窗户上,这样当用户滚动下来,我们可以测试,看看他们是否已经向下滚动到足以保证装载更多的物品的一些例子。 Soup.io的实现似乎你向下滚动,使该浏览器不应对一个不断日益庞大的DOM树删除旧项目。其中的JavaScript库将是最适合这个任务?

I am building a blog type page, and I want to load items into the page as the user scrolls down, much like Google Reader, or Soup.io. How would you go about achieving this effect? I've seen some examples which read the height of the page, and have an onScroll even attached to the window so that as the user scrolls down we can test to see if they've scrolled down far enough to warrant loading more items. Soup.io's implementation seems to remove the old items as you scroll down so that the browser isn't dealing with an ever-increasingly large DOM tree. Which javascript libraries would be best suited to this task?

推荐答案

Unspace了一篇文章,展示了这一功能:无尽Pageless :没有更多的下一页。他们的演示页面这里。

Unspace had an article demonstrating this functionality: Endless Pageless: No More Next Page. Their demonstration page is here.

这个特殊的例子使用回报率和原型。

This particular example uses RoR and Prototype.