Release: infinite-scroll.com! (w/ jquery and wordpress plugins)
Today I'm releasing www.infinite-scroll.com. Essentially infinite scroll is using ajax to pre-fetch content from a subsequent page and add it directly to the user’s current page. If you have no idea what I'm talking about, you should scroll down to the bottom of aurgasm.us, roflcon.org, or blog.molecular.com.
There is a full design pattern explanation describing when to use it, and considerations to think about when implementing. I also wrote a history of infinite scroll, to cover the history of this somewhat new ajax-enabled interaction technique.
But most importantly, there are two software releases in here:
The Infinite Scroll WordPress plugin
Enable your wordpress blog with infinite scroll functionality without knowing any javascript. You just need to know css selectors. And no theme php changes should be required to use.
The Infinite Scroll jQuery plugin
Enable anything! Obviously this is for javascript developers only, but it should give you enough flexibility to utilize in your own application.
Check it all out at www.infinite-scroll.com.
Since this is a development-focused blog, you may ask…
How is it done?
There is a little known feature in the .load() method that lets you specify the CSS selector of the html you want to include. jQuery will load in any local URL, then parse the html and grab only the elements you've defined with your selector. This allows for some pretty fun shit: client-side transclusions (a la purple include) ; and some really kickass shit when you combo it with a local php proxy.
This is really the meat of the code:
// load all post divs from page 2 into an off-DOM div $('<div/>').load('/page/2/ #content div.post',function(){ $(this).appendTo('#content'); // once they're loaded, append them to our content area });
So the infinite scroll plugin basically leverages that load() method at its core. It's basically scraping your existing page structure, which means you don't need to code any custom backend stuff to enable this functionality! Booyah, right?
The rest of the code maintains the status of the ajax call, dies when it finishes going through your pages, and show/hides the loading notification. Please take a look and let me know what you think!

What is the license on the code?
The jquery plugin is dual licensed: MIT & GPL.
The wordpress plugin is licensed GPL (2.0).
Very good post! Thank you for the work done!
Awesome. I've got this running on a w-p site I'm putting together. Can I control it's position using css?
Cheers.
thanks mate
real nice!
just what i was looking for!
:D
Great thread. Any other information about?
Restaurant Furniture
Thanks Paul, I am trying to use infinite scroll with Lazyload jquery plugin : http://www.appelsiini.net/projects/lazyload
The inital set of images seem to load perfectly however does not load the next set of image:
url to the page: http://67.20.122.201/boikeno/viewmore.php?view=popular
wondering if you could help/guide