JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<header>
</header>
<div id="main" role="main">
<div style="position: relative;">
<table id="myTable">
<tbody>
<tr>
<td>1</td>
<td>Blah Blah Blah Blah</td>
</tr>
<tr>
<td>2</td>
<td>2222 22222 22222 2222 22222</td>
</tr>
<tr>
<td>3</td>
<td>Test Test Test Test Test</td>
</tr>
<tr>
<td>4</td>
<td>4444 4444 4444 4444 4444</td>
</tr>
<tr>
<td>5</td>
<td>Hi Hi Hi Hi Hi Hi</td>
</tr>
<tr>
<td>6</td>
<td>Bye Bye Bye Bye Bye Bye Bye</td>
</tr>
</tbody>
</table>
</div>
</div>
<footer>
</footer>
</div> <!--! end of #container -->
CSS
/**
* HTML5 ✰ Boilerplate
*
* style.css contains a reset, font normalization and some base styles.
*
* Credit is left where credit is due.
* Much inspiration was taken from these projects:
* - yui.yahooapis.com/2.8.1/build/base/base.css
* - camendesign.com/design/
* - praegnanz.de/weblog/htmlcssjs-kickstart
*/
/**
* html5doctor.com Reset Stylesheet (Eric Meyer's Reset Reloaded + HTML5 baseline)
* v1.6.1 2010-09-17 | Authors: Eric Meyer & Richard Clark
* html5doctor.com/html-5-reset-stylesheet/
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
blockquote, q { quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after { content: ""; content: none; }
ins { background-color: #ff9; color: #000; text-decoration: none; }
mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
del { text-decoration: line-through; }
abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
table { border-collapse: collapse; border-spacing: 0; }
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
input, select { vertical-align: middle; }
/**
* Font normalization inspired by YUI Library's fonts.css: developer.yahoo.com/yui/
*/
body { font:13px/1.231 sans-serif; *font-size:small; } /* Hack retained to preserve specificity */
select, input, textarea, button { font:99% sans-serif;...
JavaScript
$(document).ready(function () {
//make table rows sortable
$('#myTable tbody').sortable({
start: function (event, ui) {
//fix firefox position issue when dragging.
if (navigator.userAgent.toLowerCase().match(/firefox/) && ui.helper !== undefined) {
//wire up event that changes the margin whenever the window scrolls.
$(window).bind('scroll.sortableplaylist', function () {
ui.helper.css('position', 'absolute').css('margin-top', $(window).scrollTop());
});
}
},
beforeStop: function (event, ui) {
//undo the firefox fix.
if (navigator.userAgent.toLowerCase().match(/firefox/) && ui.offset !== undefined) {
$(window).unbind('scroll.sortableplaylist');
ui.helper.css('margin-top', 0);
}
},
helper: function (e, ui) {
ui.children().each(function () {
$(this).width($(this).width());
});
return ui;
},
scroll: true,
stop: function (event, ui) {
//SAVE YOUR SORT ORDER
}
}).disableSelection();
});