Skip to content

Instantly share code, notes, and snippets.

@beckysoll
Created November 15, 2017 19:23
Show Gist options
  • Save beckysoll/bf47047c56f5de427dd3abaee22344c2 to your computer and use it in GitHub Desktop.
Save beckysoll/bf47047c56f5de427dd3abaee22344c2 to your computer and use it in GitHub Desktop.
using infinite scroll in a statamic collection/entries loop
{{ entries limit='6' paginate='true' as='articles' }}
<div class="items-wrap">
{{ if show_title=='true' }}
<h2 class="group-title"><a href="{{ url }}">{{ title }}</a></h2>
{{ /if }}
<div class="items">
{{ articles }}
<div class="item">
entry stufffff
</div>
{{ /articles }}
</div>
{{ paginate }}
{{ if next_page }}
<div class="view-more bottom-link">
<button class="more-items">View More</button>
<p style="display: none;">
<a href="{{ next_page }}" class="more-items-link">Next</a>
</p>
</div>
{{ /if }}
{{ /paginate }}
</div>
{{ /entries }}
$('.items-list .items').infiniteScroll({
path: '.more-items-link',
append: '.item',
button: '.more-items',
scrollThreshold: false,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment