如何解决Javascript帮助禁用列链接和工具提示
| 如何禁用JavaScript单击和工具提示。 您可以在这里看到问题http://www.vinderhimlen.dk/vind-rejse-deltag-i-konkurrencer-om-rejser 评级列不应显示工具提示或链接。 它附在我的表格行上:<tr class=\"thumbnail-item\" onclick=\"window.open(\'<%= vind.tracking %>\')\" onmouseout=\"this.style.background=\'white\';\" onmouseover=\"this.style.background=\'#99ff33\';this.style.cursor=\'pointer\'\">
我的工具提示脚本:
<script type=\"text/javascript\">
$(document).ready(function () {
$(\'.thumbnail-item\').mouseenter(function(e) {
x = e.pageX;
y = e.pageY;
$(this).css(\'z-index\',\'15\')
$(this).css(\'cursor\',\'default\')
$(this).find(\".tiptip\").css({\'top\': y,\'left\': x,\'display\':\'block\'});
}).mousemove(function(e) {
x = e.pageX;
y = e.pageY;
$(this).find(\".tiptip\").css({\'top\': y,\'left\': x});
}).mouseleave(function() {
$(this).css(\'z-index\',\'1\')
$(this).css(\'background\',\'none\')
$(this).css(\'color\',\'#000000\')
$(this).find(\".tiptip\").animate({\"opacity\": \"hide\"},100);
});
});
</script>
解决方法
您应该禁用mouseover事件以使其冒泡。
我已经使用firebug运行以下脚本来实现结果。
$(\"#tabel1 tr td:nth-child(2):gt(0)\")
.mouseover(
function(event)
{
event.preventDefault();
return false;
});
编辑__
由于鼠标悬停在工具提示上,因此效果不佳。将光标从工具提示移开一点。
他是您计算鼠标点的地方
x = e.pageX;
y = e.pageY;
你可以这样做
x = e.pageX+3;
y = e.pageY+3;
在mousemove和mouseover功能上
,实际上很容易。您为什么不只处理<td></td>
标签中的onmouseover / out事件,而将其保留在“评级”列中?
通过将伪类附加到tr标签或.thumbnail-item类,可以实现TR背景着色。
tr:hover
{
background-color: #99FF33;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。