JSFiddle - React, Tailwind, and code Playground
by salitrapraveen
HTML
<div id="heading">
<span id="title">GM User Role Spreadsheet Management</span>
<div id="alg-logo"></div>
<div id="toolbar">
<select>
<option value="none">Select Project</option>
</select>
<select>
<option value="none">Select Version</option>
</select>
<span id="last-updated">Last Update: PSALITRA 12/12/2012 10:12 ET </span>
</div>
</div>
<div id="page-content">
<div id="table-content">
<table>
<thead>
<tr data-fixed-row="true">
<th data-fixed-col="true">Program</th>
<th data-fixed-col="true">Function</th>
<th>Screen</th>
<th>Comments</th>
<th>Phase</th>
<th>RO</th>
<th>CSR</th>
<th>SSR</th>
<th>CSM</th>
<th>MKTSUP</th>
<th>SU</th>
<th>ASU</th>
</tr>
<tr data-fixed-row="true">
<th data-fixed-col="true"></th>
<th data-fixed-col="true"></th>
<th></th>
<th></th>
<th></th>
<th>Read Only</th>
<th>Goodwill Agent</th>
<th>Goodwill Super User</th>
<th>Goodwill Manager</th>
<th>Marketing Support</th>
<th>Sales User</th>
<th>AfterSales User</th>
</tr>
</thead>
<tbody>
<tr>
<td data-fixed-col="true">OLC</td>
<td data-fixed-col="true">View Auth</td>
<td>Column</td>
<td>Column</td>
<td>Column</td>
<td><span class="checkbox check_on"></span></td>
<td><span...
CSS
body {
background-color: #FFF;
font: 13px/1.231 sans-serif;
}
#heading {
width: 100%;
height: 51px;
position: absolute;
background-color: white;
}
#title {
text-transform:uppercase;
font-size: 16px;
font-weight: bold;
line-height: 25px;
color: #434667;
}
#alg-logo {
float: right;
width: 104px;
height: 51px;
background-color: #434667;
background-image: url(https://iagent.preprod.drmp.gm.com:4443/AGENT/images/affinionlogo.png);
position: relative;
z-index: 100;
cursor: pointer;
}
#toolbar {
width: 100%;
height: 26px;
position: relative;
background-color: #434667;
}
#toolbar select {
margin: 3px 10px 0px 10px;
}
#toolbar span {
float: right;
color: white;
margin: 6px 15px 0 0;
font-weight: bold;
font-size: 12px;
}
#page-content {
top:51px;
bottom:30px;
left: 0;
right: 0;
position: absolute;
overflow: auto;
}
#table-header {
width: 100%;
height: 30px;
}
table {
width: 100%;
border-collapse: collapse;
border-spacing: 0;
font-size: 12px;
}
tr {
line-height: 20px;
cursor: pointer;
}
th {
text-transform:uppercase;
background-color: #FAFAFA;
font-weight: bold;
text-align: center;
}
td[data-fixed-col="true"] {
font-weight: bold;
}
tr:nth-child(odd) {background-color: #DDE;}
tr:hover {background-color: #aaaadd;}
.selected {
background-color: #aaaadd;
}
th, td {
border: 1px solid #777;
padding: 5px 10px;
}
td span.checkbox {
display: block;
width: 20px;
height: 20px;
margin: auto;
cursor: pointer;
background: url(http://webdesign.maratz.com/lab/fancy-checkboxes-and-radio-buttons/check-off.png) no-repeat;
}
td span.check_on { background: url(http://webdesign.maratz.com/lab/fancy-checkboxes-and-radio-buttons/check-on.png) no-repeat; }
#footer {
width: 100%;
height: 30px;
position: fixed;
bottom: 0;
...
JavaScript
$('td span.checkbox').click(function() {
$(this).toggleClass('check_on');
});
$('tr[data-fixed-row="true"] th').hover(function() {
var ind = $(this).index() + 1;
$('td:nth-child(' + ind + '), th:nth-child(' + ind + ')').addClass('selected');
},
function() {
var ind = $(this).index() + 1;
$('td:nth-child(' + ind + '), th:nth-child(' + ind + ')').removeClass('selected');
});
$('#add-row').click(function() {
var lastTr = $('tr').last();
var newTr = lastTr.clone(true);
newTr.find('span.checkbox').removeClass('check_on');
newTr.find('td').each(function() {
var thisTd = $(this);
if (!thisTd.find('span.checkbox').length) {
thisTd.empty();
$('<input/>').attr({
'type': 'text'
}).appendTo(thisTd);
}
});
newTr.addClass('selected');
lastTr.after(newTr);
});