Stacking Tables On Small Screens with jQuery stacktable - Download Stacking Tables On Small Screens with jQuery - stacktable

Download Stacking Tables On Small Screens with jQuery – stacktable

Posted on

This time I will share jQuery Plugin and tutorial about Stacking Tables On Small Screens with jQuery – stacktable, hope it will help you in programming stack.

Stacking Tables On Small Screens with jQuery stacktable - Download Stacking Tables On Small Screens with jQuery - stacktable
File Size: 48.3 KB
Views Total: 10693
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

stacktable.js is a jQuery Plugin for equalizing the height or width of elements. With this plugin, the wide tables will be converted to a format that works better on small screens.

How to use it:

1. Markup

01 <a id="run" href="#">run »</a>
02 <table id="simple-example-table" cellspacing="0">
03 <tbody>
04 <tr align="left">
05 <th width="30%">Stuff</th>
06 <th width="12%">Rate</th>
07 <th width="12%">Amount</th>
08 <th width="12%">Points</th>
09 <th width="12%">Number</th>
10 <th width="18%">Type</th>
11 <th width="12%">Name</th>
12 </tr>
13 <tr>
14 <td>Something</td>
15 <td>3.375%</td>
16 <td>$123.12</td>
17 <td>1.125</td>
18 <td>4,000</td>
19 <td>Potato</td>
20 <td>Paul</td>
21 </tr>
22 <tr>
23 <td>Something Else</td>
24 <td>2.750%</td>
25 <td>$345.23</td>
26 <td>5</td>
27 <td>180</td>
28 <td>Spaceship</td>
29 <td>Skippy</td>
30 </tr>
31 <tr>
32 <td colspan="7" class="sub">Subgroup Header</td>
33 </tr>
34 <tr>
35 <td>Another Thing</td>
36 <td>3.375%</td>
37 <td>$563.12</td>
38 <td>222</td>
39 <td>60</td>
40 <td>Gym Shoe</td>
41 <td>George</td>
42 </tr>
43 <tr>
44 <td>Thing w/Less Stuff</td>
45 <td></td>
46 <td></td>
47 <td></td>
48 <td></td>
49 <td>Harmonica</td>
50 <td>Helga</td>
51 </tr>
52 <tr>
53 <td>Last Thing</td>
54 <td></td>
55 <td></td>
56 <td></td>
57 <td>4</td>
58 <td>Meaning of Life</td>
59 <td></td>
60 </tr>
61 </tbody>
62 </table>

2. Include jQuery library and stacktable.js

1 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
2 <script>window.jQuery || document.write('<script src="js/libs/jquery-1.8.1.min.js"></script>')</script> </script>
3 <script src="stacktable.js" type="text/javascript"></script>

3. Call the plugin

1 <script>
2   $(document).on('click', '#run', function(e) {
3     e.preventDefault();
4     $('#simple-example-table').stacktable({hideOriginal:true});
5     $(this).replaceWith('<span>ran</span>');
6   });
7 </script>

Change logs:

2017-06-10

  • Adding support for thead as first row

2017-02-05

  • bugfix

2016-06-12

  • bugfix

2015-11-19

  • deprecate unnecessary hideOriginal setting
  • v1.0.1

2015-11-02

2015-01-17

  • add card table function

2014-11-01

  • Added support for headIndex, in order to choose what cell use as header.
  • Some variable name changes (the two “index” became “rowIndex” and “cellIndex”, in order to avoid ambiguities).

2013-12-18

  • fixed documentation on index.html; class variable should be myClass
  • remove unused var.

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

source : jqueryscript.net