Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Facebook achieve infinite scrolling?

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?

like image 774
Hoa Avatar asked May 01 '12 21:05

Hoa


People also ask

Does Facebook scroll forever?

But that doesn't exist anymore. Now, if you login to Facebook (or any other social media account, for that matter) you start scrolling through your feed and just keep on scrolling forever.

How is infinite scroll implemented?

Infinite scrolling will require two key parts. One part will be a check for the window scroll position and the height of the window to determine if a user has reached the bottom of the page. Another part will be handling the request for additional information to display.

Why is my Facebook page scrolling by itself?

The answer to your question might surprise you, but your Facebook page is probably jumping because of your browser or Facebook app. Facebook page jumping is the same as the page refreshing. Usually, when this happens, the page jumps back to the top of the page, no matter if you were at the middle or bottom.

Why is infinite scroll so addictive?

Research shows that users go from one post to another on social media every 19 seconds. When we scroll through our feeds switching between content so quickly, the brain gets a hit of dopamine each time, creating a sort of neurological 'high. ' It's that rush that keeps you scrolling through the content.


1 Answers

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).

There is a jQuery plugin for that called Infinite Scroll.

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.

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.

like image 103
Nathan Avatar answered Oct 02 '22 05:10

Nathan