Javascript jQuery hover仅在Internet Explorer中工作
我对悬停有意见。它们在IE中运行良好,但在Mozilla Firefox或Chrome中则不行。我猜这是因为它相当模糊,每个td,但现在这是我需要的。这是提琴(不起作用)提前谢谢 HTML文件Javascript jQuery hover仅在Internet Explorer中工作,javascript,jquery,css,cross-browser,hover,Javascript,Jquery,Css,Cross Browser,Hover,我对悬停有意见。它们在IE中运行良好,但在Mozilla Firefox或Chrome中则不行。我猜这是因为它相当模糊,每个td,但现在这是我需要的。这是提琴(不起作用)提前谢谢 HTML文件 <table> <tr> <td>one</td> </tr> <tr> <td>two</td> </tr> <tr&
<table>
<tr>
<td>one</td>
</tr>
<tr>
<td>two</td>
</tr>
<tr>
<td>three</td>
</tr>
</table>
<div class="modalPop">Modal Information</div>
jQuery
$(document).ready(function(){
$('td').hover(
function(){$('.modalPop' + this).stop().hide().fadeIn('slow');},
function(){$('.modalPop' + this).stop(true, true).fadeOut('slow');}
);
});
$('.modalPop'+此)
无效<代码>此是一个对象。您正在尝试用对象连接字符串。只需使用$('.modalPop')
如果在控制台(chrome tools或firebug)上打开,您将看到如下错误:
$('td').hover(
function(){$('.modalPop').stop().hide().fadeIn('slow').html("Modal Information : " + $(this).text());},
function(){$('.modalPop').stop(true, true).fadeOut('slow');}
);
未捕获错误:语法错误,无法识别的表达式:.modalPop[object HTMLTableCellElement]
坦白地说,我不明白它为什么在IE中工作。你为什么要在字符串中添加
这个?我想你的意思是这样的:
$('td').hover(
function(){$('.modalPop').stop().hide().fadeIn('slow').html("Modal Information : " + $(this).text());},
function(){$('.modalPop').stop(true, true).fadeOut('slow');}
);
$('.modalPop'+此)
???向字符串添加元素。我很惊讶它在任何地方都能工作?我没有看到a.modalPop
元素…你有没有看过你的控制台错误?