如果您将鼠标悬停在价格上,您会注意到价格和 .catTr td 的第一个子项被突出显示。其他都不是。目标是创建一个非常清晰的网格,以显示所选择的内容。
我怎样才能让它对 tr.cat 列中的每个子 td 应用相同的样式?
直播链接:http ://www.sinsysonline.com/cameron/nick/repair/price.html
HTML:
<table id="prices">
<tr>
<td class="clear"></td>
</tr>
<tr class="head">
<td class="clear"></td>
<td class="head">
<a href="desktop.html"><h3>Desktop</h3></a>
</td>
<td class="head">
<a href="laptop.html"><h3>Laptop</h3></a>
</td>
<td class="head">
<a href="server.html"><h3>Server</h3></a>
</td>
</tr>
<tr id="priceRow">
<td class="clear"></td>
<td class="price">
<h2>Testing</h2>
</td>
<td class="price">
<h2>Testing</h2>
</td>
<td class="price">
<h2>Testing</h2>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_hwrep.html">Hardware Repair</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="catTr">
<td class="category">
<a href="services_netts.html">Network Troubleshooting</a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
<td>
<a href="services_hwrep.html"><img src="../css/images/check.png" /></a>
</td>
</tr>
<tr class="foot">
<td div class="clear"></td>
<td class="foot">
<a href="contact.html" class="action_button">Contact Us</a>
</td>
<td class="foot">
<a href="contact.html" class="action_button">Contact Us</a>
</td>
<td class="foot">
<a href="contact.html" class="action_button">Contact Us</a>
</td>
</tr>
</table>
jQuery:
<script>
(function() {
$('tr.catTr td').not('.category').hover(function(){
var priceSel = $(this).index();
$('tr#priceRow td').eq(priceSel).addClass('price_hover');
$('tr.catTr td').eq(priceSel).addClass('vertFilt');
$(this).closest('tr').find('td.category').addClass('category_hover');
},function(){
var priceSel = $(this).index();
$('tr#priceRow td').eq(priceSel).removeClass('price_hover');
$('tr.catTr td').eq(priceSel).removeClass('vertFilt');
$(this).closest('tr').find('td.category').removeClass('category_hover');
});
})();
</script>
直播链接: http ://www.sinsysonline.com/cameron/nick/repair/price.html
现在,如何突出显示列中的每个等效子项......
我知道我需要对 .each() 做一些事情,但我不确定将它放在哪里......