Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here is what I figured out:</p> <p>HTML:</p> <pre><code>&lt;html&gt; &lt;style&gt; .highlight {background:gray;} &lt;/style&gt; &lt;body&gt; &lt;div&gt; &lt;div style="float: left"&gt; &lt;table id="names" class="grid" style="width:200px"&gt; &lt;tr class="row0"&gt;&lt;th style="width:40%"&gt;Last&lt;/th&gt;&lt;th&gt;First&lt;/th&gt;&lt;/tr&gt; &lt;tr class="row1"&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt; &lt;tr class="row2"&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt; &lt;tr class="row3"&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt; &lt;tr class="row4"&gt;&lt;td&gt;Smith&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;/tr&gt; &lt;!-- etc --&gt; &lt;/table&gt; &lt;/div&gt; &lt;div style="float: left; overflow-x: scroll"&gt; &lt;table id="results" class="grid" style="width:200px"&gt; &lt;tr class="row0"&gt;&lt;th&gt;Test 1&lt;/th&gt;&lt;th&gt;Test 2&lt;/th&gt;&lt;/tr&gt; &lt;tr class="row1"&gt;&lt;td&gt;50%&lt;/td&gt;&lt;td&gt;70%&lt;/td&gt;&lt;/tr&gt; &lt;tr class="row2"&gt;&lt;td&gt;50%&lt;/td&gt;&lt;td&gt;70%&lt;/td&gt;&lt;/tr&gt; &lt;tr class="row3"&gt;&lt;td&gt;50%&lt;/td&gt;&lt;td&gt;70%&lt;/td&gt;&lt;/tr&gt; &lt;!-- etc --&gt; &lt;/table&gt; &lt;/div&gt; &lt;div style="clear: both"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>JS:</p> <pre><code>$(document).ready(function() { $("table#names tr:not(:first-child)").each(function(k, v){ var self = this; // index: 0 = second row; 1= 3rd row... of table#names // index+1 for other table's row: .find('tr.row'+(index+1)) (function(index){ $(self).hover( function() { $(this).addClass("highlight"); // go up to parent div of #names, then its siblings, then the siblings' table's row // you could also just $('table#results') $('table#names').parent().siblings().find('tr.row'+(index+1)).addClass("highlight"); }, function() { $('table#names').parent().siblings().find('tr.row'+(index+1)).removeClass("highlight"); $(this).removeClass("highlight"); } ); })(k); // pass index so function above remembers it }); }); </code></pre> <p>JSFiddle: <a href="http://jsfiddle.net/6aNy2/" rel="nofollow">http://jsfiddle.net/6aNy2/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload