【发布时间】:2012-02-06 17:11:47
【问题描述】:
我遇到了这个问题,在编写带有悬停效果的小表格时,会导致它更改行。 但是,在原文中,我也想使用链接。当用户将鼠标悬停在这些链接上时,我不希望出现悬停效果。
相关代码,其中popup 是行的类(悬停在该行上会激活 hoverIntent 以将这些行更改为其他行)。带有链接的要排除的span 有一个名为linky 的类。:
<script type="text/javascript">
$(document).ready(function(){
$(".popup").hoverIntent( hover, original );
});
function hover(){
$(this).addClass("hovering");
$(".hovering .original").fadeOut(50, function() {
$(".hovering .hover").fadeIn(300);
});
}
function original(){
$(".hovering .hover").fadeOut(50, function() {
$(".hovering .original").fadeIn(300);
$(".popup").removeClass("hovering");
});
}
</script>
<table>
<tr class='header'>
<th>row</th>
<th>row</th>
<th>row</th>
<th>row (the ones below are just a javascript fix, because it otherwise changes position on hover, when using this system. They are not visible.)</th>
<th>row</th>
<th>row</th>
</tr>
<tr class='popup'>
<td class='original'>First column</td>
<td class='original'><span class='linky'><a>mylink</a></span><!-- this span should be excluded --></td>
<td class='original'>Third column</td>
<td class='hover' style='display:none;'>this one gets displayed when hovering 1</td>
<td class='hover' style='display:none;'>this one gets displayed when hovering 2</td>
<td class='hover' style='display:none;'>this one gets displayed when hovering 3</td>
</tr>
</table>
如果我忘记了一些东西,我很抱歉,但必须全部重写,因为它嵌入在 PHP 脚本中。
最好的问候, 美术
【问题讨论】:
-
另外,为什么我的问候语:“你好,”被删除了? :(
标签: javascript jquery hover