|
15 | 15 | $(window).ready(function () {
|
16 | 16 | $('#table1').ReStable();
|
17 | 17 | $('#table2').ReStable({rowHeaders:false});
|
| 18 | + $('#table3').ReStable({keepHtml : true,rowHeaders : false}); |
| 19 | + $('#table4').ReStable({keepHtml : true,rowHeaders : false}); |
18 | 20 | });
|
19 | 21 | </script>
|
20 | 22 | </head>
|
21 | 23 | <body>
|
22 |
| - |
23 |
| - <div class="container"> |
24 |
| - |
25 |
| - <h1>jQuery ReStable <span>v0.1.1</span></h1> |
26 |
| - |
27 |
| - <p><strong>jQuery ReStable</strong> is a very simple and lightweight (~1Kb) jQuery plugin that make tables responsive making them collapse into ul lists.</p> |
28 |
| - |
29 |
| - <a href="" class="download_button">Download it on GitHub</a> |
30 |
| - |
31 |
| - <p>To use it you just have to include jQuery and a copy of the plugin in your head or footer:</p> |
32 |
| - <pre><script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> |
| 24 | + |
| 25 | + <div class="container"> |
| 26 | + |
| 27 | + <h1>jQuery ReStable <span>v0.1.1</span></h1> |
| 28 | + |
| 29 | + <p><strong>jQuery ReStable</strong> is a very simple and lightweight (~1Kb) jQuery plugin that make tables responsive making them collapse into ul lists.</p> |
| 30 | + |
| 31 | + <a href="https://github.com/micc83/ReStable" class="download_button">Download it on GitHub</a> |
| 32 | + |
| 33 | + <p>To use it you just have to include jQuery and a copy of the plugin in your head or footer:</p> |
| 34 | + <pre><script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> |
33 | 35 | <script type="text/javascript" src="jquery.restable.min.js"></script>
|
34 | 36 | <link rel="stylesheet" href="jquery.restable.min.css"></pre>
|
35 | 37 |
|
36 |
| - <p>Let's say this is your table:</p> |
37 |
| - |
38 |
| - <pre><table class="mytable"> |
| 38 | + <p>Let's say this is your table:</p> |
| 39 | + |
| 40 | + <pre><table class="mytable"> |
39 | 41 | <thead>
|
40 | 42 | <tr>
|
41 | 43 | <td>Period</td>
|
@@ -65,116 +67,162 @@ <h1>jQuery ReStable <span>v0.1.1</span></h1>
|
65 | 67 | </tr>
|
66 | 68 | </tbody>
|
67 | 69 | </table></pre>
|
68 |
| - |
69 |
| - <p>Now the only thing to do is to trigger the action with:</p> |
70 |
| - |
71 |
| - <pre>$(window).ready(function () { |
| 70 | + |
| 71 | + <p>Now the only thing to do is to trigger the action with:</p> |
| 72 | + |
| 73 | + <pre>$(window).ready(function () { |
72 | 74 | $.ReStable();
|
73 | 75 | });</pre>
|
74 | 76 |
|
75 |
| - <p>This will target automatically all the tables in the page but you can, off course, target one or more elements with:</p> |
| 77 | + <p>This will target automatically all the tables in the page but you can, off course, target one or more elements with:</p> |
76 | 78 |
|
77 |
| - <pre>$(window).ready(function () { |
| 79 | + <pre>$(window).ready(function () { |
78 | 80 | $('.mytable').ReStable();
|
79 | 81 | });</pre>
|
80 |
| - <p>If you need more control here's the plugin settings:</p> |
81 |
| - <pre>$('.mytable').ReStable({ |
| 82 | + <p>If you need more control here's the plugin settings:</p> |
| 83 | + <pre>$('.mytable').ReStable({ |
82 | 84 | rowHeaders: true, // Table has row headers?
|
83 |
| - maxWidth: 480 // Size to which the table become responsive |
| 85 | + maxWidth: 480, // Size to which the table become responsive |
| 86 | + keepHtml: false // Keep the html content of cells, only work with rowHeaders = false |
84 | 87 | });</pre>
|
85 |
| - |
86 |
| - <h2>Some examples</h2> |
87 |
| - |
88 |
| - <span class="title">Example A - Responsive Pricelist Table (with row headers)</span> |
89 |
| - |
90 |
| - <table id="table1"> |
91 |
| - <thead> |
92 |
| - <tr> |
93 |
| - <th>Period</th> |
94 |
| - <th>Full Board</th> |
95 |
| - <th>Half Board</th> |
96 |
| - <th>Bed and Breakfast</th> |
97 |
| - </tr> |
98 |
| - </thead> |
99 |
| - <tbody> |
100 |
| - <tr> |
101 |
| - <td>01/10/12 - 02/10/12</td> |
102 |
| - <td>20 €</td> |
103 |
| - <td>30 €</td> |
104 |
| - <td>40 €</td> |
105 |
| - </tr> |
106 |
| - <tr> |
107 |
| - <td>03/10/12 - 04/10/12</td> |
108 |
| - <td>40 €</td> |
109 |
| - <td>50 €</td> |
110 |
| - <td>60 €</td> |
111 |
| - </tr> |
112 |
| - <tr> |
113 |
| - <td>05/10/12 - 06/10/12</td> |
114 |
| - <td>70 €</td> |
115 |
| - <td>80 €</td> |
116 |
| - <td>90 €</td> |
117 |
| - </tr> |
118 |
| - </tbody> |
119 |
| - </table> |
120 |
| - |
121 |
| - <pre>$('#table1').ReStable();</pre> |
122 |
| - |
123 |
| - <span class="title">Example B - Responsive Columns Table (without row headers)</span> |
124 |
| - |
125 |
| - <table id="table2"> |
126 |
| - <thead> |
127 |
| - <tr> |
128 |
| - <td>Carbon</td> |
129 |
| - <td>Hydrogen</td> |
130 |
| - <td>Nitrogen</td> |
131 |
| - <td>Oxygen</td> |
132 |
| - </tr> |
133 |
| - </thead> |
134 |
| - <tbody> |
135 |
| - <tr> |
136 |
| - <td>10</td> |
137 |
| - <td>15</td> |
138 |
| - <td>1</td> |
139 |
| - <td>0</td> |
140 |
| - </tr> |
141 |
| - <tr> |
142 |
| - <td>8</td> |
143 |
| - <td>11</td> |
144 |
| - <td>1</td> |
145 |
| - <td>2</td> |
146 |
| - </tr> |
147 |
| - <tr> |
148 |
| - <td>10</td> |
149 |
| - <td>15</td> |
150 |
| - <td>1</td> |
151 |
| - <td>1</td> |
152 |
| - </tr> |
153 |
| - <tr> |
154 |
| - <td>12</td> |
155 |
| - <td>17</td> |
156 |
| - <td>1</td> |
157 |
| - <td>1</td> |
158 |
| - </tr> |
159 |
| - <tr> |
160 |
| - <td>14</td> |
161 |
| - <td>19</td> |
162 |
| - <td>1</td> |
163 |
| - <td>2</td> |
164 |
| - </tr> |
165 |
| - </tbody> |
166 |
| - </table> |
167 |
| - |
168 |
| - <pre>$('#table2').ReStable({ |
| 88 | + |
| 89 | + <h2>Some examples</h2> |
| 90 | + |
| 91 | + <span class="title">Example A - Responsive Pricelist Table (with row headers)</span> |
| 92 | + |
| 93 | + <table id="table1"> |
| 94 | + <thead> |
| 95 | + <tr> |
| 96 | + <th>Period</th> |
| 97 | + <th>Full Board</th> |
| 98 | + <th>Half Board</th> |
| 99 | + <th>Bed and Breakfast</th> |
| 100 | + </tr> |
| 101 | + </thead> |
| 102 | + <tbody> |
| 103 | + <tr> |
| 104 | + <td>01/10/12 - 02/10/12</td> |
| 105 | + <td>20 €</td> |
| 106 | + <td>30 €</td> |
| 107 | + <td>40 €</td> |
| 108 | + </tr> |
| 109 | + <tr> |
| 110 | + <td>03/10/12 - 04/10/12</td> |
| 111 | + <td>40 €</td> |
| 112 | + <td>50 €</td> |
| 113 | + <td>60 €</td> |
| 114 | + </tr> |
| 115 | + <tr> |
| 116 | + <td>05/10/12 - 06/10/12</td> |
| 117 | + <td>70 €</td> |
| 118 | + <td>80 €</td> |
| 119 | + <td>90 €</td> |
| 120 | + </tr> |
| 121 | + </tbody> |
| 122 | + </table> |
| 123 | + |
| 124 | + <pre>$('#table1').ReStable();</pre> |
| 125 | + |
| 126 | + <span class="title">Example B - Responsive Columns Table (without row headers)</span> |
| 127 | + |
| 128 | + <table id="table2"> |
| 129 | + <thead> |
| 130 | + <tr> |
| 131 | + <td>Carbon</td> |
| 132 | + <td>Hydrogen</td> |
| 133 | + <td>Nitrogen</td> |
| 134 | + <td>Oxygen</td> |
| 135 | + </tr> |
| 136 | + </thead> |
| 137 | + <tbody> |
| 138 | + <tr> |
| 139 | + <td>10</td> |
| 140 | + <td>15</td> |
| 141 | + <td>1</td> |
| 142 | + <td>0</td> |
| 143 | + </tr> |
| 144 | + <tr> |
| 145 | + <td>8</td> |
| 146 | + <td>11</td> |
| 147 | + <td>1</td> |
| 148 | + <td>2</td> |
| 149 | + </tr> |
| 150 | + <tr> |
| 151 | + <td>10</td> |
| 152 | + <td>15</td> |
| 153 | + <td>1</td> |
| 154 | + <td>1</td> |
| 155 | + </tr> |
| 156 | + <tr> |
| 157 | + <td>12</td> |
| 158 | + <td>17</td> |
| 159 | + <td>1</td> |
| 160 | + <td>1</td> |
| 161 | + </tr> |
| 162 | + <tr> |
| 163 | + <td>14</td> |
| 164 | + <td>19</td> |
| 165 | + <td>1</td> |
| 166 | + <td>2</td> |
| 167 | + </tr> |
| 168 | + </tbody> |
| 169 | + </table> |
| 170 | + |
| 171 | + <pre>$('#table2').ReStable({ |
169 | 172 | rowHeaders : false
|
170 | 173 | });</pre>
|
171 | 174 |
|
172 |
| - <h2>Credits and contacts</h2> |
173 |
| - |
174 |
| - <p><strong>ReStable </strong> has been made by <a href=" http://codeb.it" target=" _blank" >me </a>. You can contact me at <a href=" mailto:[email protected]" >[email protected]</a> or <a href=" https://twitter.com/Micc1983" target=" _blank" >twitter </a> for any issue or feauture request. </p> |
175 |
| - |
176 |
| - |
177 |
| - </div> |
178 |
| - |
| 175 | + <span class="title">Example C - Responsive Columns Table with html support (without row headers)</span> |
| 176 | + |
| 177 | + <table id="table3"> |
| 178 | + <thead> |
| 179 | + <tr> |
| 180 | + <th>Avatar</th> |
| 181 | + <th>Username</th> |
| 182 | + <th>Email</th> |
| 183 | + <th>Description</th> |
| 184 | + </tr> |
| 185 | + </thead> |
| 186 | + <tbody> |
| 187 | + <tr> |
| 188 | + <td><img src="http://www.placehold.it/400x400"></td> |
| 189 | + <td>Pinco</td> |
| 190 | + |
| 191 | + <td><p>Lorem ipsum dolor sit amet, consectetur <strong>adipiscing elit</strong>. Nulla molestie vulputate lectus, eu aliquam erat cursus ac. Etiam finibus <em>pellentesque turpis</em> vitae lacinia. Suspendisse lorem nibh, gravida aliquam arcu in, iaculis consectetur nisl. Pellentesque eu mattis sapien.</p></td> |
| 192 | + </tr> |
| 193 | + <tr> |
| 194 | + <td><img src="http://www.placehold.it/400x400"></td> |
| 195 | + <td>Pallino</td> |
| 196 | + |
| 197 | + <td><p>Lorem ipsum dolor sit amet, <strong>consectetur adipiscing</strong> elit.</p></td> |
| 198 | + </tr> |
| 199 | + <tr> |
| 200 | + <td><img src="http://www.placehold.it/400x400"></td> |
| 201 | + <td>Asdrubale</td> |
| 202 | + |
| 203 | + <td> |
| 204 | + <p>Nulla molestie vulputate lectus, eu aliquam erat cursus ac. Etiam finibus pellentesque turpis vitae lacinia.</p> |
| 205 | + <ul> |
| 206 | + <li>Element 1</li> |
| 207 | + <li>Element 2</li> |
| 208 | + <li>Element 3</li> |
| 209 | + </ul> |
| 210 | + </td> |
| 211 | + </tr> |
| 212 | + </tbody> |
| 213 | + </table> |
| 214 | + |
| 215 | + <pre>$('#table3').ReStable({ |
| 216 | + keepHtml : true, |
| 217 | + rowHeaders : false |
| 218 | +});</pre> |
| 219 | + |
| 220 | + <h2>Credits and contacts</h2> |
| 221 | + |
| 222 | + <p><strong>ReStable </strong> has been made by <a href=" http://codeb.it" target=" _blank" >me </a>. You can contact me at <a href=" mailto:[email protected]" >[email protected]</a> or <a href=" https://twitter.com/Micc1983" target=" _blank" >twitter </a> for any issue or feauture request. </p> |
| 223 | + |
| 224 | + |
| 225 | + </div> |
| 226 | + |
179 | 227 | </body>
|
180 | 228 | </html>
|
0 commit comments