JSFiddle - React, Tailwind, and code Playground
by Eric Howe
HTML
<div>
<div style="float: left">
<table id="names" class="grid">
<tr><th>Last</th><th>First</th></tr>
<tr><td>Smith</td><td>John</td></tr>
<tr><td>Smith</td><td>John</td></tr>
<tr><td>Smith</td><td>John</td></tr>
<!-- etc -->
</table>
</div>
<div style="float: left; overflow-x: scroll">
<table id="results" class="grid">
<tr><th>Test 1</th><th>Test 2</th></tr>
<tr><td>50%</td><td>70%</td></tr>
<tr><td>50%</td><td>70%</td></tr>
<tr><td>50%</td><td>70%</td></tr>
<!-- etc -->
</table>
</div>
<div style="clear: both">
</div>
</div>
CSS
.highlight {
background: #eee;
}
JavaScript
var $trs = $('table.grid tr:not(:first-child)');
$trs.hover(
function() {
var i = $(this).index() + 1;
$trs.filter(':nth-child(' + i + ')').addClass('highlight');
},
function() {
var i = $(this).index() + 1;
$trs.filter(':nth-child(' + i + ')').removeClass('highlight');
}
);