-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added gulpfile to improve workflow * Added keepHtml option to keep cell html (only work with rowHeaders = false) * Multiple css fixes
- Loading branch information
Showing
11 changed files
with
276 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,27 +15,29 @@ | |
$(window).ready(function () { | ||
$('#table1').ReStable(); | ||
$('#table2').ReStable({rowHeaders:false}); | ||
$('#table3').ReStable({keepHtml : true,rowHeaders : false}); | ||
$('#table4').ReStable({keepHtml : true,rowHeaders : false}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>jQuery ReStable <span>v0.1.1</span></h1> | ||
<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> | ||
<a href="" class="download_button">Download it on GitHub</a> | ||
<p>To use it you just have to include jQuery and a copy of the plugin in your head or footer:</p> | ||
<pre><script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> | ||
<div class="container"> | ||
<h1>jQuery ReStable <span>v0.1.1</span></h1> | ||
<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> | ||
<a href="https://github.com/micc83/ReStable" class="download_button">Download it on GitHub</a> | ||
<p>To use it you just have to include jQuery and a copy of the plugin in your head or footer:</p> | ||
<pre><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"></pre> | ||
|
||
<p>Let's say this is your table:</p> | ||
<pre><table class="mytable"> | ||
<p>Let's say this is your table:</p> | ||
<pre><table class="mytable"> | ||
<thead> | ||
<tr> | ||
<td>Period</td> | ||
|
@@ -65,116 +67,162 @@ <h1>jQuery ReStable <span>v0.1.1</span></h1> | |
</tr> | ||
</tbody> | ||
</table></pre> | ||
<p>Now the only thing to do is to trigger the action with:</p> | ||
<pre>$(window).ready(function () { | ||
<p>Now the only thing to do is to trigger the action with:</p> | ||
<pre>$(window).ready(function () { | ||
$.ReStable(); | ||
});</pre> | ||
|
||
<p>This will target automatically all the tables in the page but you can, off course, target one or more elements with:</p> | ||
<p>This will target automatically all the tables in the page but you can, off course, target one or more elements with:</p> | ||
|
||
<pre>$(window).ready(function () { | ||
<pre>$(window).ready(function () { | ||
$('.mytable').ReStable(); | ||
});</pre> | ||
<p>If you need more control here's the plugin settings:</p> | ||
<pre>$('.mytable').ReStable({ | ||
<p>If you need more control here's the plugin settings:</p> | ||
<pre>$('.mytable').ReStable({ | ||
rowHeaders: true, // Table has row headers? | ||
maxWidth: 480 // Size to which the table become responsive | ||
maxWidth: 480, // Size to which the table become responsive | ||
keepHtml: false // Keep the html content of cells, only work with rowHeaders = false | ||
});</pre> | ||
<h2>Some examples</h2> | ||
<span class="title">Example A - Responsive Pricelist Table (with row headers)</span> | ||
<table id="table1"> | ||
<thead> | ||
<tr> | ||
<th>Period</th> | ||
<th>Full Board</th> | ||
<th>Half Board</th> | ||
<th>Bed and Breakfast</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>01/10/12 - 02/10/12</td> | ||
<td>20 €</td> | ||
<td>30 €</td> | ||
<td>40 €</td> | ||
</tr> | ||
<tr> | ||
<td>03/10/12 - 04/10/12</td> | ||
<td>40 €</td> | ||
<td>50 €</td> | ||
<td>60 €</td> | ||
</tr> | ||
<tr> | ||
<td>05/10/12 - 06/10/12</td> | ||
<td>70 €</td> | ||
<td>80 €</td> | ||
<td>90 €</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<pre>$('#table1').ReStable();</pre> | ||
<span class="title">Example B - Responsive Columns Table (without row headers)</span> | ||
<table id="table2"> | ||
<thead> | ||
<tr> | ||
<td>Carbon</td> | ||
<td>Hydrogen</td> | ||
<td>Nitrogen</td> | ||
<td>Oxygen</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>10</td> | ||
<td>15</td> | ||
<td>1</td> | ||
<td>0</td> | ||
</tr> | ||
<tr> | ||
<td>8</td> | ||
<td>11</td> | ||
<td>1</td> | ||
<td>2</td> | ||
</tr> | ||
<tr> | ||
<td>10</td> | ||
<td>15</td> | ||
<td>1</td> | ||
<td>1</td> | ||
</tr> | ||
<tr> | ||
<td>12</td> | ||
<td>17</td> | ||
<td>1</td> | ||
<td>1</td> | ||
</tr> | ||
<tr> | ||
<td>14</td> | ||
<td>19</td> | ||
<td>1</td> | ||
<td>2</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<pre>$('#table2').ReStable({ | ||
<h2>Some examples</h2> | ||
<span class="title">Example A - Responsive Pricelist Table (with row headers)</span> | ||
<table id="table1"> | ||
<thead> | ||
<tr> | ||
<th>Period</th> | ||
<th>Full Board</th> | ||
<th>Half Board</th> | ||
<th>Bed and Breakfast</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>01/10/12 - 02/10/12</td> | ||
<td>20 €</td> | ||
<td>30 €</td> | ||
<td>40 €</td> | ||
</tr> | ||
<tr> | ||
<td>03/10/12 - 04/10/12</td> | ||
<td>40 €</td> | ||
<td>50 €</td> | ||
<td>60 €</td> | ||
</tr> | ||
<tr> | ||
<td>05/10/12 - 06/10/12</td> | ||
<td>70 €</td> | ||
<td>80 €</td> | ||
<td>90 €</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<pre>$('#table1').ReStable();</pre> | ||
<span class="title">Example B - Responsive Columns Table (without row headers)</span> | ||
<table id="table2"> | ||
<thead> | ||
<tr> | ||
<td>Carbon</td> | ||
<td>Hydrogen</td> | ||
<td>Nitrogen</td> | ||
<td>Oxygen</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>10</td> | ||
<td>15</td> | ||
<td>1</td> | ||
<td>0</td> | ||
</tr> | ||
<tr> | ||
<td>8</td> | ||
<td>11</td> | ||
<td>1</td> | ||
<td>2</td> | ||
</tr> | ||
<tr> | ||
<td>10</td> | ||
<td>15</td> | ||
<td>1</td> | ||
<td>1</td> | ||
</tr> | ||
<tr> | ||
<td>12</td> | ||
<td>17</td> | ||
<td>1</td> | ||
<td>1</td> | ||
</tr> | ||
<tr> | ||
<td>14</td> | ||
<td>19</td> | ||
<td>1</td> | ||
<td>2</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<pre>$('#table2').ReStable({ | ||
rowHeaders : false | ||
});</pre> | ||
|
||
<h2>Credits and contacts</h2> | ||
|
||
<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> | ||
|
||
|
||
</div> | ||
|
||
<span class="title">Example C - Responsive Columns Table with html support (without row headers)</span> | ||
|
||
<table id="table3"> | ||
<thead> | ||
<tr> | ||
<th>Avatar</th> | ||
<th>Username</th> | ||
<th>Email</th> | ||
<th>Description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><img src="http://www.placehold.it/400x400"></td> | ||
<td>Pinco</td> | ||
<td><a href="mailto:[email protected]">[email protected]</a></td> | ||
<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> | ||
</tr> | ||
<tr> | ||
<td><img src="http://www.placehold.it/400x400"></td> | ||
<td>Pallino</td> | ||
<td><a href="mailto:[email protected]">[email protected]</a></td> | ||
<td><p>Lorem ipsum dolor sit amet, <strong>consectetur adipiscing</strong> elit.</p></td> | ||
</tr> | ||
<tr> | ||
<td><img src="http://www.placehold.it/400x400"></td> | ||
<td>Asdrubale</td> | ||
<td><a href="mailto:[email protected]">[email protected]</a></td> | ||
<td> | ||
<p>Nulla molestie vulputate lectus, eu aliquam erat cursus ac. Etiam finibus pellentesque turpis vitae lacinia.</p> | ||
<ul> | ||
<li>Element 1</li> | ||
<li>Element 2</li> | ||
<li>Element 3</li> | ||
</ul> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
<pre>$('#table3').ReStable({ | ||
keepHtml : true, | ||
rowHeaders : false | ||
});</pre> | ||
|
||
<h2>Credits and contacts</h2> | ||
|
||
<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> | ||
|
||
|
||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var $ = require('gulp-load-plugins')(); | ||
|
||
var pkg = require('./package.json'); | ||
var banner = ['/**', | ||
' * <%= pkg.name %> - <%= pkg.description %>', | ||
' * @version v<%= pkg.version %>', | ||
' * @link <%= pkg.homepage %>', | ||
' * @license <%= pkg.license %>', | ||
' */', | ||
''].join('\n'); | ||
|
||
gulp.task('minify-css', function () { | ||
return gulp.src('jquery.restable.css') | ||
.pipe($.csso()) | ||
.pipe($.rename({suffix: '.min'})) | ||
.pipe($.header(banner, {pkg:pkg})) | ||
.pipe(gulp.dest('')) | ||
.pipe($.size()); | ||
}); | ||
|
||
gulp.task('minify-js', function () { | ||
return gulp.src('jquery.restable.js') | ||
.pipe($.jshint()) | ||
.pipe($.jshint.reporter('jshint-stylish')) | ||
.pipe($.uglify()) | ||
.pipe($.rename({suffix: '.min'})) | ||
.pipe($.header(banner, {pkg:pkg})) | ||
.pipe(gulp.dest('')) | ||
.pipe($.size()); | ||
}); | ||
|
||
gulp.task('default', ['minify-css', 'minify-js']); |
Oops, something went wrong.