diff --git a/.gitignore b/.gitignore index b512c09..eb79dd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +.idea diff --git a/README.md b/README.md index 368f41f..c95c81d 100755 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ If you need more control here's the plugin settings: $('.mytable').ReStable({ rowHeaders: true, // Table has row headers? maxWidth: 480, // Size to which the table become responsive - keepHtml: false // Keep the html content of cells, only work with rowHeaders = false + keepHtml: false // Keep the html content of cells }); ## Credits and contacts diff --git a/demo/index.html b/demo/index.html index a4f169d..d938b57 100755 --- a/demo/index.html +++ b/demo/index.html @@ -1,43 +1,47 @@ - - - - - jQuery ReStable - Responsive tables to list jquery plugin - - - - - - + + + + + + - - - -
- -

jQuery ReStable v0.1.1

- -

jQuery ReStable is a very simple and lightweight (~1Kb) jQuery plugin that make tables responsive making them collapse into ul lists.

- - Download it on GitHub - -

To use it you just have to include jQuery and a copy of the plugin in your head or footer:

-
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
+    
+
+
+
+
+ +

jQuery ReStable v0.1.2

+ +

jQuery ReStable is a very simple and lightweight (~1Kb) jQuery plugin that make tables + responsive making them collapse into ul lists.

+ + Download it on GitHub + +

To use it you just have to include jQuery and a copy of the plugin in your head or footer:

+
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
 <script type="text/javascript" src="jquery.restable.min.js"></script>
-<link rel="stylesheet" href="jquery.restable.min.css">
+<link rel="stylesheet" href="jquery.restable.min.css">
-

Let's say this is your table:

+

Let's say this is your table:

-
<table class="mytable">
+            
<table class="mytable">
     <thead>
         <tr>
             <td>Period</td>
@@ -66,163 +70,172 @@ 

jQuery ReStable v0.1.1

<td>90 €</td> </tr> </tbody> -</table>
- -

Now the only thing to do is to trigger the action with:

+</table>
+ +

Now the only thing to do is to trigger the action with:

-
$(window).ready(function () {
+            
$(window).ready(function () {
     $.ReStable();
-});
+});
-

This will target automatically all the tables in the page but you can, off course, target one or more elements with:

+

This will target automatically all the tables in the page but you can, off course, target one or more elements + with:

-
$(window).ready(function () {
+            
$(window).ready(function () {
     $('.mytable').ReStable();
-});
-

If you need more control here's the plugin settings:

-
$('.mytable').ReStable({
+});
+

If you need more control here's the plugin settings:

+
$('.mytable').ReStable({
     rowHeaders: true, // Table has row headers?
     maxWidth: 480, // Size to which the table become responsive
-    keepHtml: false // Keep the html content of cells, only work with rowHeaders = false
-});
- -

Some examples

- - Example A - Responsive Pricelist Table (with row headers) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PeriodFull BoardHalf BoardBed and Breakfast
01/10/12 - 02/10/1220 €30 €40 €
03/10/12 - 04/10/1240 €50 €60 €
05/10/12 - 06/10/1270 €80 €90 €
- -
$('#table1').ReStable();
- - Example B - Responsive Columns Table (without row headers) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CarbonHydrogenNitrogenOxygen
101510
81112
101511
121711
141912
+ keepHtml: false // Keep the html content of cells +});
+ +

Some examples

+ + Example A - Responsive Pricelist Table (with row headers) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PeriodFull BoardHalf BoardBed and Breakfast
01/10/12 - 02/10/1220 €30 €40 €
03/10/12 - 04/10/1240 €50 €60 €
05/10/12 - 06/10/1270 €80 €90 €
+ +
$('#table1').ReStable();
+ + Example B - Responsive Columns Table (without row headers) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CarbonHydrogenNitrogenOxygen
101510
81112
101511
121711
141912
-
$('#table2').ReStable({
+            
$('#table2').ReStable({
     rowHeaders : false
-});
- - Example C - Responsive Columns Table with html support (without row headers) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AvatarUsernameEmailDescription
Pincopinco@example.it

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla molestie vulputate lectus, eu aliquam erat cursus ac. Etiam finibus pellentesque turpis vitae lacinia. Suspendisse lorem nibh, gravida aliquam arcu in, iaculis consectetur nisl. Pellentesque eu mattis sapien.

Pallinopallino@example.it

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Asdrubaleasdrubale@example.it -

Nulla molestie vulputate lectus, eu aliquam erat cursus ac. Etiam finibus pellentesque turpis vitae lacinia.

-
    -
  • Element 1
  • -
  • Element 2
  • -
  • Element 3
  • -
-
- -
$('#table3').ReStable({
+});
+ + Example C - Responsive Columns Table with html support (without row headers) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AvatarUsernameEmailDescription
Pincopinco@example.it

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla molestie vulputate + lectus, eu aliquam erat cursus ac. Etiam finibus pellentesque turpis vitae lacinia. Suspendisse + lorem nibh, gravida aliquam arcu in, iaculis consectetur nisl. Pellentesque eu mattis sapien.

Pallinopallino@example.it

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Asdrubaleasdrubale@example.it +

Nulla molestie vulputate lectus, eu aliquam erat cursus ac. Etiam finibus pellentesque turpis vitae + lacinia.

+
    +
  • Element 1
  • +
  • Element 2
  • +
  • Element 3
  • +
+
+ +
$('#table3').ReStable({
     keepHtml : true,
     rowHeaders : false
-});
- -

Credits and contacts

- -

ReStable has been made by me. You can contact me at micc83@gmail.com or twitter for any issue or feauture request.

- - -
- - +}); + +

Credits and contacts

+ +

+ ReStable has been made by me. + You can contact me at micc83@gmail.com + or twitter + for any issue or feauture request. +

+ + + + + diff --git a/jquery.restable.css b/jquery.restable.css index e563fe6..798bfaa 100755 --- a/jquery.restable.css +++ b/jquery.restable.css @@ -1,9 +1,9 @@ /* Table */ ul.tabletolist { - border-bottom: 2px solid #eee;font-size: 14px;margin:0 0 20px 0 !important; + border-bottom: 2px solid #eee;font-size: 14px;margin:0 0 20px 0; } /* Image */ -ul.tabletolist .row_data img { +ul.tabletolist img { max-width: 100%; } /* Table with no row headers */ @@ -40,11 +40,11 @@ ul.tabletolist > li > ul > li:last-child { } /* Table row header */ ul.tabletolist ul > li .row_headers { - font-size:12px;max-width: 40%; + font-size:12px;max-width: 40%;float:left;margin-right: 3%; } /* Table row data */ ul.tabletolist ul > li .row_data { - float:right;font-weight:800;max-width: 60%; + float:right;font-weight:800;max-width: 57%; } /* Clearfix */ ul.tabletolist > li > ul > li {*zoom: 1;} diff --git a/jquery.restable.min.css b/jquery.restable.min.css index 1901460..37097d4 100755 --- a/jquery.restable.min.css +++ b/jquery.restable.min.css @@ -4,4 +4,4 @@ * @link http://codeb.it/restable/ * @license MIT */ -ul.tabletolist{border-bottom:2px solid #eee;font-size:14px;margin:0 0 20px!important}ul.tabletolist .row_data img{max-width:100%}ul.tabletolist.nrh{border-bottom:2px solid #ddd}ul.tabletolist.nrh>li{border-top:2px solid #ddd}ul.tabletolist,ul.tabletolist>li>ul{padding:0!important;list-style:none!important}ul.tabletolist>li>ul{margin:0!important}ul.tabletolist>li .titles{background-color:#bbb;display:block;color:#fff;padding:10px;font-weight:800}ul.tabletolist>li>ul>li{font-weight:200;border-bottom:1px solid #eee;padding:10px}ul.tabletolist>li>ul>li:hover{background-color:#efefef}ul.tabletolist>li>ul>li:last-child{border-bottom:none}ul.tabletolist ul>li .row_headers{font-size:12px;max-width:40%}ul.tabletolist ul>li .row_data{float:right;font-weight:800;max-width:60%}ul.tabletolist>li>ul>li{*zoom:1}ul.tabletolist>li>ul>li:before{content:" ";display:table}ul.tabletolist>li>ul>li:after{content:" ";display:table;clear:both}ul.tabletolist ul>li .row_data.html{font-weight:400}ul.tabletolist ul>li .row_data.html ul{list-style-type:disc} \ No newline at end of file +ul.tabletolist{border-bottom:2px solid #eee;font-size:14px;margin:0 0 20px}ul.tabletolist img{max-width:100%}ul.tabletolist.nrh{border-bottom:2px solid #ddd}ul.tabletolist.nrh>li{border-top:2px solid #ddd}ul.tabletolist,ul.tabletolist>li>ul{padding:0!important;list-style:none!important}ul.tabletolist>li>ul{margin:0!important}ul.tabletolist>li .titles{background-color:#bbb;display:block;color:#fff;padding:10px;font-weight:800}ul.tabletolist>li>ul>li{font-weight:200;border-bottom:1px solid #eee;padding:10px}ul.tabletolist>li>ul>li:hover{background-color:#efefef}ul.tabletolist>li>ul>li:last-child{border-bottom:none}ul.tabletolist ul>li .row_headers{font-size:12px;max-width:40%;float:left;margin-right:3%}ul.tabletolist ul>li .row_data{float:right;font-weight:800;max-width:57%}ul.tabletolist>li>ul>li{*zoom:1}ul.tabletolist>li>ul>li:before{content:" ";display:table}ul.tabletolist>li>ul>li:after{content:" ";display:table;clear:both}ul.tabletolist ul>li .row_data.html{font-weight:400}ul.tabletolist ul>li .row_data.html ul{list-style-type:disc} \ No newline at end of file