- Apr 01, 2014
- by Dave Matteson
Every developer has had content that needs to be listed out line by line. Usually that means there is or will be a lot of it. Whether it’s a list of past entries in your WordPress blog, a list of nodes in your Drupal site or a list of items for sale in your favorite shopping software. It used to be there was only one right answer of how to deal with this kind of content; pagination. You’d choose some number (or let the user choose) of entries to display per page and then list off the number of pages, letting the user navigate through as needed. Perhaps if you felt sophisticated you’d allow filtering and sorting.
In today’s modern web there’s another option; infinite scroll. You may have encountered this technique on Facebook, Tumblr or Twitter on pages that let you keep scrolling seemingly indefinitely without ever needing to reload the page.. This technique works by initially loading the first page of data, and as the user scrolls down, fetch additional data via AJAX to load onto the page. It’s an elegant solution for things like your Twitter feed or a list of comments. Anything where the content is pretty much always going to be accessed in the same order.
But infinite scroll does add implementation complexity in a lot of cases, so it’s worth considering if your use case is a good fit or not. If the average user is expected to specify a sort order or filter and then access only the first handful of entries, then pagination makes the most sense. You’ll note that as of press time, Google for example, is still using pagination. This is because most users only look at the first few results. Adding infinite scroll to the results page would add needless complexity.
Like with most modern web techniques, it’s best to consider whether the new way of doing things really is the ideal fit for your particular case, or whether your users might be best served by an older design pattern.