<p>You can order the elements with a function you supply. In the demo above, each item has a <code>data-date-created</code> and <code>data-title</code> attribute. When the select option menu changes, a sort object is passed to shuffle.</p>
<p>The <codeclass="language-javascript">options</code> object can contain three properties:</p>
<ul>
<li><codeclass="language-javascript">reverse</code>: a boolean which will reverse the resulting order.</li>
<li><codeclass="language-javascript">by</code>: a function with an element as the parameter. Above, we’re returning the value of the <codeclass="language-markup">data-date-created</code> or <codeclass="language-markup">data-title</code> attribute.</li>
<li><codeclass="language-javascript">randomize</code>: Make the order random.</li>
</ul>
<p>Returning <codeclass="language-javascript">undefined</code> from the <codeclass="language-javascript">by</code> function will reset the order to DOM order.</p>