You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
989 B
HTML
22 lines
989 B
HTML
<h2>Adding and removing items<a href="#adding-removing"></a></h2>
|
|
<p>You can add and remove elements from shuffle after it has been created. This also works for infinite scrolling.</p>
|
|
|
|
<h3>Add a collection</h3>
|
|
<div class="code-block">
|
|
<pre rel="JavaScript"><code class="language-javascript">// Adds 2 <div>s to an existing Shuffle instance.
|
|
var $item1 = $('<div class="gallery-item item1">')
|
|
var $item2 = $('<div class="gallery-item item2">')
|
|
var $items = $item1.add($item2);
|
|
$('#my-shuffle').append($items);
|
|
$('#my-shuffle').shuffle('appended', $items);</code></pre>
|
|
</div>
|
|
|
|
<h3>Remove a collection</h3>
|
|
<div class="code-block">
|
|
<pre rel="JavaScript"><code class="language-javascript">// Remove the 2 <div>s which were just added.
|
|
var $items = $('.gallery-item');
|
|
$('#my-shuffle').shuffle('remove', $items);</code></pre>
|
|
</div>
|
|
|
|
<p class="demo-link-container">Check out the <a href="{{ site.baseurl }}{% post_url 2013-06-19-adding-removing %}">demo</a>.</p>
|