jQuery hover仅适用于Internet Explorer

tri*_*t77 0 javascript css jquery cross-browser hover

我有一个悬停的问题.它们在IE中运行良好,但不适用于Mozilla Firefox或Chrome.我猜它是因为它相当模糊,每一个td但是现在这就是我需要的东西.这是小提琴(不工作)http://jsfiddle.net/233qG/提前谢谢.

HTML

<table>
    <tr>
        <td>one</td>
    </tr>
    <tr>
        <td>two</td>
    </tr>
    <tr>
        <td>three</td>
    </tr>
</table>
<div class="modalPop">Modal Information</div>
Run Code Online (Sandbox Code Playgroud)

CSS

div.modalPop
{
    display:none;
    position:absolute;
    border:solid 1px black;
    padding:8px;
    background-color:white;
    margin: 280px 50px 0 0;
    z-index: 9999;
}
a.modalPop:hover + div.modalPop
{
    display:block;
}
div.modalPop:hover
{
    display:block;
}
Run Code Online (Sandbox Code Playgroud)

jQuery

$(document).ready(function(){
    $('td').hover(
      function(){$('.modalPop' + this).stop().hide().fadeIn('slow');},
      function(){$('.modalPop' + this).stop(true, true).fadeOut('slow');}
    );  
});
Run Code Online (Sandbox Code Playgroud)

Tre*_*vor 8

$('.modalPop' + this)是无效的.this是一个对象.您正在尝试使用对象连接字符串.只是用$('.modalPop')

如果您在控制台(chrome工具或firebug)上打开,您应该会看到如下错误:

未捕获错误:语法错误,无法识别的表达式:.modalPop [object HTMLTableCellElement]

坦率地说,我不明白为什么它甚至在IE中工作.你为什么要加入this字符串?