Thursday 22 January 2015

Simple ways to implement infinite scrolling on your website


Infinite scrolling embodies one of the ideal attributes of any good design: people can use it without thinking about it.


Once you’ve encountered it a couple of times, you forget about it. I’d say that most of us have come to expect certain applications, or perhaps certain kinds of applications, to simply load more content when we hit the bottom of a page. And why not? It’s effective, and often convenient.


In some contexts, constantly clicking to see successive pages can quickly become a drag. In these cases, pagination is not a helpful navigation tool, but an interruption to the browsing experience. Infinite scrolling — while it does come with problems of its own — goes a long way towards creating smoother experiences.


This is especially true when you have to browse large amounts of information that’s split up into small chunks. Common examples include: Twitter, news sites, tumblogs, image galleries, and so on.


Of course, it’s not for everyone, or every project. For those of you who have decided to add some infinite love to your sites, there are several effective ways to easily apply it to your site:


Infinite scrolling for static sites


In most cases, you’ll probably be adding this kind of behavior to sites/apps that have dynamic content stored in a database. I’ve decided to include a link that revolves around static sites for two reasons:


  1. You may need to know how to do this specifically. You never know.

  2. Once you know how to add infinite scrolling to a static site, you’ll probably be able to adapt the same techniques to any CMS or CMS theme that you happen to be familiar with.

This tutorial from Hongkiat.com features two different jQuery plugins for your consideration, including Infinite Scroll by Paul Irish.


Infinite scrolling for WordPress sites


I’m not sure that there’s any sort of feature or functionality under the sun that hasn’t been made available for WordPress in the form of a plugin. Infinite scrolling is, of course, no exception.


First, we once again have Infinite Scroll. Yup. This jQuery plugin comes with an official WordPress implementation also made by Paul Irish. The link is right there on the plugin’s main site, prominent and visible, right at the top. Also included on the page is a tutorial to help you configure the plugin to work with your specific WordPress theme, so be sure to check out the documentation.


Next, we have proof that Automattic, the company behind WordPress, loves us and wants us to be happy. They created a Jetpack module that will also add infinite scrolling to your theme. Again, you may need to customize the plugin to work with your specific theme.


But what if you want to dive deep into the code, and learn how to do it from scratch? WPTuts+ has you covered with this rather in-depth tutorial. Recommended for people with an intermediate understanding of front-end code, the tutorial comes with everything you need to hardcode infinite scrolling into your theme. Some would even argue that this is the “right way” to do it.


Infinite scrolling for Tumblr themes


Lots of designers, and some developers, make use of tumblr for sharing their thoughts and/or work. Are you one of them? Do you want your Tumblr theme to scroll infinitely, just like your dashboard? Look no further than Cody Sherman’s tutorial. Since it was written for the average, non-coding Tumblr user, this tutorial is dead simple. This comes at a cost, though, as it may not work with every Tumblr theme.


Mixing infinite scrolling with other plugins


jQuery Masonry is the classic plugin for creating masonry-style layouts on the web. (Personally, I think the name gives it away.) Since masonry layouts are all about displaying the small bits of information that are often well-served by infinite scrolling, it’s no surprise that many websites combine the two behaviors. For static sites, you should check out the official documentation here.


Isotope is similar in function to Masonry, in that it was created to help people implement masonry layouts. I include it here because, in my opinion, it’s actually better. This is mostly because, through trial and error, I was able to make a truly responsive masonry layout with this jQuery plugin. I’ve had less luck with others. Your experiences may vary. Check out the documentation here.




Simple ways to implement infinite scrolling on your website

No comments:

Post a Comment