Skip to content

Instantly share code, notes, and snippets.

@arlopezg
Last active February 8, 2018 10:23
Show Gist options
  • Select an option

  • Save arlopezg/45b5e25c6b9df33faea1f91664741a57 to your computer and use it in GitHub Desktop.

Select an option

Save arlopezg/45b5e25c6b9df33faea1f91664741a57 to your computer and use it in GitHub Desktop.
Set up the data collection to be paginated
{% paginate collection.products by 3 %}
<!-- Start the pagination and tells Ajaxify how many items to load at once -->
<div class="EndlessScroll">
<!-- Ajaxify will insert the items in this element -->
{% for product in collection.products %}
{% include 'product-grid-item' %}
{% endfor %}
<!-- Regular data collection loop -->
{% if paginate.next %}
<div class="pagination">
<a href="{{ paginate.next.url }}">Loading More</a>
</div>
{% endif %}
<!-- Tells Ajaxify what to show when a new page is available -->
<!-- Modifying this part is optional, it works fine out of the box -->
</div>
{% endpaginate %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment