So I'm making a tool to help students learn foreign language. It's basically two columns of text, first in the targeted language, and the other in English. The one I'm currently making is for Greek.
What my goal is that when a word in the first is hovered over it's highlighted and the corresponding word in English in the second column is also highlighted.
The numbers have to be also explicitly named because the Greek and English word order is not the same, and I figured I can do it with classes.
<table>
<tr>
<td class=greek>
<span class="adv one">Πολλάκις</span>
<span class="adj one">βραχεῖα</span>
<span class="noun one">ἡδονὴ</span>
<span class="adj two">μακρὰν</span>
<span class="verb one">τίκτει</span>
<span class="noun two">λύπην</span>.
</td>
<td class=eng>
<span class="adj one">Short</span>
<span class="noun one">pleasure</span>
<span class="adv one">often</span>
<span class="verb one">begets</span>
<span class="adj two">long</span>
<span class="noun two">pain</span>.
</td>
</tr>
</table>
But I have really basic knowledge of JQuery so I don't know how to move to selecting the same word in both columns with the same number.
$(".greek > .noun").hover(
function() {
$(".greek > .noun, .eng > .noun").css({'color': 'white', 'background-color': 'rgb(79,129,189)'});
}, function() {
$(".greek > .noun, .eng > .noun").css({'color': 'black', 'background-color': 'rgb(255,255,255)'});
}
);
I also want to make it work in reverse, that is when I hover over a word in the English column, the corresponding word in the Greek columns gets highlighted as well.