jQuery Plugin To Sort Order HTML List sdFilterMe - Download jQuery Plugin To Sort & Order HTML Lists - sdFilterMe

Download jQuery Plugin To Sort & Order HTML Lists – sdFilterMe

Posted on

This time I will share jQuery Plugin and tutorial about jQuery Plugin To Sort & Order HTML Lists – sdFilterMe, hope it will help you in programming stack.

jQuery Plugin To Sort Order HTML List sdFilterMe - Download jQuery Plugin To Sort & Order HTML Lists - sdFilterMe
File Size: 7.31 KB
Views Total: 2171
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

sdFilterMe is a simple yet robust jQuery plugin which allows for sorting and re-ordering of html lists with custom animations and several useful options.

Key features:

  • Filter through a group of elements using HTML5 data arrtibutes.
  • Sort the elements in ascending or descending order.
  • Smooth shuffle effect based on CSS3 transitions.

How to use it:

1. Include the main JS file jquery.sdFilterMe.js after you’ve included jQuery library.

1 <script src="//code.jquery.com/jquery.min.js"></script>
2 <script src="jquery.sdFilterMe.js"></script>

2. Uses CSS class for sorting / filtering data, and data-order for ordering data as follows:

01 <ul id="sort-demo">
02   <li class="food" data-title="2" data-order="2>
03       <img src="http://lorempixel.com/200/200/food/1"/>
04   </li>
05   <li class="sports" data-title="5" data-order="5">
06       <img src="http://lorempixel.com/200/200/sports/1"/>
07   </li>
08   <li class="sports" data-title="6" data-order="6">
09       <img src="http://lorempixel.com/200/200/sports/3"/>
10   </li>
11   <li class="business" data-title="1" data-order="1">
12       <img src="http://lorempixel.com/200/200/business/4"/>
13   </li>
14   <li class="food" data-title="4" data-order="4">
15       <img src="http://lorempixel.com/200/200/food/5"/>
16   </li>
17   ...
18 </ul>

3. If you want to append a link to the list item:

1 <li class="food" data-title="2" data-order="2" data-link="https://www.jqueryscript.net/">

4. Create sorting / ordering buttons.

1 <button class="sorter" data-filter="food">Food</button>
2 <button class="sorter" data-filter="sports">Sports</button>
3 <button class="sorter" data-filter="business">Business</button>
4 <button class="sorter" data-filter="nature">Nature</button>
5 <button class="sorter" data-filter="*">All</button>
6  
7 <button class="orderer" data-order="asc">ASC</button>
8 <button class="orderer" data-order="desc">DESC</button>

5. Initialize the sdFilterMe plugin and done.

1 $('#sort-demo').sdFilterMe({
2   // options here
3 })

6. Possible options to customize the plugin.

01 $('#sort-demo').sdFilterMe({
02   filterSelector: '.sorter',
03   orderSelector: '.orderer',
04   duration: 1000,
05   animation: 'ease',
06   hoverEffect: true,
07   sortedOut: 'disappear',
08   css: {
09       overlay: {
10           background: {
11               r: 0,
12               v: 0,
13               b: 0
14           },
15           duration: 250,
16           border: '1px solid white',
17           color: 'white',
18           opacity: 0.5
19       },
20       border: {
21           width: 10,
22           color: '#2A4153'
23       },
24       margin: 10,
25       pointer: true
26   },
27   nothingToShow: {
28       text: 'Nothing to show'
29   }
30 })

7. The plugin provides an event which will ben triggered when the user clicks on a list item.

1 $('#sort-demo').sdFilterMe()
2 .on('fm.boxClicked', function(e, position, order) {
3   console.log('Box position is ' + position);
4   console.log('Box sort order is ' + order);
5 });

This awesome jQuery plugin is developed by stevedavid. For more Advanced Usages, please check the demo page or visit the official website.

source : jqueryscript.net