Is there a simple way to reorder my list items using a class?
I want to specify a class to feature those items at the top of the list first, with other list items listed below.
<ul class="order-me">
<li class="">normal content</li>
<li class="">normal content</li>
<li class="featured">featured content</li>
<li class="">normal content</li>
<li class="featured">featured content</li>
<li class="">normal content</li>
<li class="">normal content</li>
</ul>
Desired output:
<ul class="order-me">
<li class="featured">featured content</li>
<li class="featured">featured content</li>
<li class="">normal content</li>
<li class="">normal content</li>
<li class="">normal content</li>
<li class="">normal content</li>
<li class="">normal content</li>
</ul>
Thanks!
You can prepend the
.featured
elements to their containingul
to move them to the top of the list. Try this:To add to @Rory McCrossan's answer, I've added the ability to sort it with navigation buttons
Here is the Fiddle