Facebook如何实现无限滚动? [英] How does Facebook achieve infinite scrolling?

查看:127
本文介绍了Facebook如何实现无限滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的第一个问题是他们如何获得这个滚动条?

My first question is how do they get this scroll bar?

http://dl.dropbox.com/u/12337149/scrollbar.png

我已经看到了几个地方,所以我认为它可能在一个公共图书馆?我的第二个问题涉及无限滚动本身。再次,我已经看到它在几个网站,所以它是一个比较常见的技术,并在某个地方描述。

I have seen it in a few places so I presume it might be in a public library? My second question relates to the infinite scrolling itself. Once again I have seen it on a few sites so is it a technique that is relatively common and is described somewhere?

推荐答案

做你的意思是像Twitter一样的懒惰负载效果(滚动时,当您到达底部时,它会加载更多)?他们使用 AJAX(异步JavaScript和XML),并衡量何时到达底部并加载更多数据。但是他们使用JSON,因为大多数人比XML容易(但它仍然称为AJAX)。

Do you mean the "lazy load" effect like on Twitter (when you scroll, it loads more when you reach the bottom)? They use AJAX (Asynchronous JavaScript and XML) and measure when you reach the bottom and load more data. But they use JSON since it is easier to most people than XML (but it is still called AJAX).

有一个jQuery插件,称为无限滚动

There is a jQuery plugin for that called Infinite Scroll.

另外对于滚动条的事情,那些就像Mac OS X Lion的滚动条(最有可能是他们得到的想法),这里是另一个 Stack Overflow post 关于它。

Also for the scroll bar thing, those are like Mac OS X Lion's scrollbar (which is most likely where they got the idea from), here's another Stack Overflow post about it.

我希望这有助于给你一些关于这些东西的信息。

I hope this helps give you some information about this stuff.

如果你不知道jQuery是什么,那么它是一个令人敬畏的JavaScript库,使JavaScript的代码更快。如果你没有使用它/听说过,你应该查看 jQuery.com

And by the way if you don't know what jQuery is, it is an awesome library for JavaScript and makes everything faster to code in JavaScript. You should check it out at jQuery.com if you never used it/heard of it.

这篇关于Facebook如何实现无限滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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