Keep in scrolling!

1.0.1 2018-09-07 15:26 UTC

This package is auto-updated.

Last update: 2019-12-30 15:17:13 UTC


Keep on scrolling!


This plugin requires Craft CMS 3.0.0-beta.23 or later.


To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
  2. Then tell Composer to load the plugin:

     composer require statikbe/craft-infinite-scroll
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for Infinite Scroll.


There are several parameters you can use to control how the infinite scroll plugin behaves. These options are:

Parameter Type Default Description
containerSelector string null The parent container for the paginated items
itemSelector string null The selector for the item
loadingMessage string "Loading more posts..." The message to show when loading more items
loadingImage string image The image to show when loading more items
finishedMessage string "There are no more items to load" The message to show when you reach the end of the item list

User Guide

###1. Add infinite scrolling to your template

The plugin requires jquery, so you must ensure that this library is loaded in order for infinite scrolling to work!

Pass the paginate variable to the custom twig method infinitescroll, and specify the container selector as well as the item selector like so:

{{ paginate|infinitescroll(containerSelector="#container", itemSelector="article.item") }}

You can also pass any of the additional optional parameters, like so:

{{ paginate|infinitescroll(containerSelector="#container", itemSelector="article.item", finishedMessage="So Long, and Thanks for All the Fish") }}

Here is a more in depth example, showing the instantiation of pagination on an entry channel and the integration of infinite scrolling:

{% set entries = craft.entries.section('news').limit(1).order('postDate desc') %}

<div id="left-main-content">
    {% paginate entries as entriesOnPage %}

        {% for entry in entriesOnPage %}
            <article class="news-row">
                <h2>{{ entry.title }}</h2>
                {{ entry.body }}
        {% endfor %}

        {{ paginate|infinitescroll(containerSelector="#left-main-content", itemSelector="") }}

    {% endpaginate %}

Inspired by BM-Infinite-Scroll

Brought to you by Statik