intercooler
Version:
Making AJAX as easy as anchor tags
49 lines (36 loc) • 1.65 kB
HTML
---
layout: default
nav: tutorial
---
<div class="container" xmlns="http://www.w3.org/1999/html">
<div class="row">
<div class="col-md-12">
<h1>Infinite Scroll</h1>
<p>This tutorial will show you how to implement infinite scroll with only a few lines of IntercoolerJS.</p>
<h3>Video</h3>
<div class="text-center">
<iframe src="//player.vimeo.com/video/92342606" width="1000" height="750" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen style="max-width:100%"></iframe>
</div>
<h3>Outline</h3>
<p>Here are the steps for implementing infinite scroll</p>
<ul>
<li>
Extract a partial of the row rendering for your table, and add an id to the enclosing <code>tbody</code> so
we can target it for appending.
</li>
<li>
Add an empty <code>span</code> to the last element in the table that uses the
<a href="/attributes/ic-append-from.html"><code>ic-append-from</code></a>,
<a href="/attributes/ic-target.html"><code>ic-target</code></a>, and
<a href="/attributes/ic-trigger-on.html"><code>ic-trigger-on</code></a>
attributes to trigger appending to the table body.</a>
</li>
</ul>
<h3>Git Diff</h3>
<p>Here is a diff between the will-paginate code and Intercooler code:</p>
<a href="https://github.com/LeadDyno/intercooler-tutorial-app/commit/13daf988bc86c5da1e62fea8def155e3e8ea5307">
https://github.com/LeadDyno/intercooler-tutorial-app/commit/13daf988bc86c5da1e62fea8def155e3e8ea5307
</a>
</div>
</div>
</div>