Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Infinite scrolling inside a div with AJAX (jQuery) loaded date

Tags:

jquery

ajax

I've been trying to figure this out over several questions here on SO, finding out the different parts and then assembling them, but now I'm giving up.

What I'm trying do do:

The user is on a page, clicks a button and a list of content loads into a div using jQuerys .ajax. When he or she scrolls to the bottom of the div, load more content. As seen on Twitter, but this is inside a div.

I've seen examples on how to have infinite loading in scroll, but the problem is that those examples reload the entire page (it seems)

Has anyone got any idea how I can accomplish this?

As said, I cannot accomplish this using normal means.

The page is build as:

Page 1, has a div, empty until the user clicks a button.

Page 2 loads a lot of content. When the user clicks on the button on page 1, this is loaded into the div.

When the user scrolls through the div (It has overflow set to auto) and ends at the bottom of the div it should load the next page or so to speak.

Thanks in advance! :)

like image 295
Olive Avatar asked Jun 10 '11 19:06

Olive


1 Answers

There are some plugins which do this for you quite well.

http://www.webdeveloperjuice.com/2010/02/24/create-infinte-scroll-effect-using-jquery-with-demo/

http://www.beyondcoding.com/2009/01/15/release-jquery-plugin-endless-scroll/

EDIT: Some more up to date plugins:

https://github.com/fredwu/jquery-endless-scroll

http://www.infinite-scroll.com/infinite-scroll-jquery-plugin/

like image 143
472084 Avatar answered Oct 07 '22 21:10

472084