Jump to content

Infinite Scroll + ProcessWire?

Lance O.

Recommended Posts

Depends on the situation. I think for a status/time POV like Twitter or Facebook an infinate scroll is a very good solution, but one has to think very carefully how to implement this. I've seen this being used on newspages and mostly it's just a fancy solution for a problem that's doesn't exist.

  • Like 1
Link to comment
Share on other sites

Step 1. create a PW template like this:

         $results = $pages->find('template=articles,start='.$offset.',limit=20');

    foreach($results as $item){?>
          .... your html here ....
    <?php }?>

Step 2. In the page that you want infinite scroll, do something like this in JS

.... when the user scrolls to the bottom...
$('body').append('<div id="section"></div>');
... Figure out how many items you want to load, calculate your offset ...

None of this is production code. Just trying to show the concept.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the comments. I implemented infinite scroll on a development site, but after seeing it in action, my client decided not to use it.

If I implement this functionality on a live site in the future, I'll be sure to share my experience. Thanks again.

Link to comment
Share on other sites

I'm using a nice variation of the infinite scroll


This plugin it's really easy to use, it doesn't requires any particular modification in the code because it uses the pagination links to generate the infinite scroll, in this way also google is happy because I generate my content with pagination as usual and the users have the enhanced version.

  • Like 6
Link to comment
Share on other sites

  • 5 months later...

I've been wrapping my head around infinite ajax scroll from the most of last night. I had it working, although I can't seem to reach the end of the pages. If I have 4 pages, it would scroll up to page 3 and won't show the 4th page. I'm not quite sure why.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...