"Load More" for list on mobile site - How to?

6 posts by 4 authors in: Forums > CMS Builder
Last Post: September 10, 2012   (RSS)

By zip222 - August 23, 2012

I have a mobile site that I would like to implement a "Load More" button on. I have seen this on a lot of mobile sites recently and find this to be preferable to pagination.

When the page first loads, the first 20 items would be visible along with a "Load More" button at the bottom of the list. Clicking the button would query the database and load the next 20 articles, etc...

Can any provide any thoughts/suggestions/guidance on how to do this?

Re: [zip222] "Load More" for list on mobile site - How to?

By Dave - August 23, 2012

Hi zip222,

It's done with AJAX, and some custom PHP, Javascript, and HTML. There's a general tutorial here:
http://www.9lessons.info/2009/12/twitter-style-load-more-results-with.html

Basically you create a load more button that runs some javascript that makes a request in the background for more content, then javascript appends that on the end of a page or div, etc.

Some sites also set it up so it loads more the moment you scroll to the bottom of that page.

Hope that helps, let me know any questions.
Dave Edis - Senior Developer
interactivetools.com

Re: [zip222] "Load More" for list on mobile site - How to?

By Toledoh - August 23, 2012

I've been playing with this, but have put it on the back burner, mainly because I figured I needs X results on a mobile in portrait and X in landscape, then more on iPad, more on desktops etc... and as I was working on a grid layout, the differences we dramatic.

http://www.fieg.nl/infinite-ajax-scroll-a-jquery-plugin and http://www.infinite-scroll.com/ where the best options I can up with. Both easy to get the basic "load more" working.
Cheers,

Tim (toledoh.com.au)

Re: [rez] "Load More" for list on mobile site - How to?

By Toledoh - August 27, 2012

Responsive site is fine, I have a grid structure on a wide screen of 9 "squares" across, and as you reduce screen width to mobile-portrait of 2 squares across. Just CSS and media queries.

However, to fill a "page" on a large screen I wanted to show a grid of 9 by 8 squares... 72 records, but on a mobile show 2 by 9, 18 records... and all the combinations in between.

I can get the infinite scroll working fine, loading the next pages just by using the generic code, and using the "records per page" code from the standard CMSB generated code. However, with the loading more records on a mobile, 72 records at a time... I just thoughts it wasn't a nice result. I ended up just doing the "next page" as standard.

I have used masonry previously, but not needed on this project, I just used my own CSS. The site should be live soon and I'll send you a link if you like.
Cheers,

Tim (toledoh.com.au)

Re: [rez] "Load More" for list on mobile site - How to?

Hey Rez / Zip222,

Did you get this working?

It works pretty well here http://redbalifrog.com.au however keeps repeating the last items.

The issue seems to be that the next page ?page=... . see comments https://github.com/paulirish/infinite-scroll/issues/49 but i'm not sure how to fix it.

Any ideas?
Cheers,

Tim (toledoh.com.au)