An AJAX page loading script for WordPress

I have been experimenting with a custom AJAX page loader for my WordPress blog in recent months. Today I broke this project out into its own repo, available here: WP AJAX Page Loader. It is readily installed via Bower: bower install wp-ajax-page-loader. Some additional work is required to integrate and configure this script for your own projects.

I starting working on this project after learning about some of the many problems associated with history.js, a polyfill that many infinite scrolling implementations rely on to this very day. After having a look at some of the options I decided to adapt one of my own scripts to achieve pretty much the same effect with a much smaller payload size and a bit of a smoother user experience (or one that suits my needs anyway).

This script requires jQuery (already included in WordPress), HTML5 History API, and spin.js. Without jQuery (but with the other dependencies) it clocks in at about 15.5 Kb minified (comparable to the 21 Kb of Paul Irish’s Infinite Scroll).

Read the documentation or peruse the source code for more information or have a look at Pendrell for an example of integration and configuration. This script is currently active on this site so you should be able to demo it by browsing around any of the archives and clicking on “next” (or simply positioning the viewport near—but not at—the bottom of the page, for I am running the script in “footer safe” mode).

Related posts

Respond

Markdown and HTML enabled in comments.
Your email address will not be published. Required fields are marked *