2012-04-04 49 views
1
不工作

我有这样的代码无法在IE8工作:如果jQuery的。是( “:悬停”)在IE8

$("#intro-screenshot").hover(
    function(){ 
     $(".img-action").show(); 
    }, 
    function(){ 
     if(!$(".img-action").is(":hover")) { 
     $(".img-action").hide(); 
     } 
    } 
); 

它打破了在这条线:if(!$(".img-action").is(":hover"))

HTML:

<a href="#"> 
    <img src="#" alt="" id="intro-screenshot" /> 
    <span class="img-action" style="top:90px; left:115px;"> 
    See Features 
    </span> 
</a> 

我不认为这是一个已知的Jquery的问题,但我可能是错的..

JSFIDDLE

+0

什么JQuery的版本是您使用的jsfiddle? – Greg 2012-04-04 13:28:28

+0

你可以做一个jsfiddle吗? – 2012-04-04 13:33:20

+0

jquery 1.6.2和jsfiddle上面 – greener 2012-04-04 13:45:50

回答

1

如果你试试这个:

$("#intro-screenshot").hover(
    function(){ 
     $(".img-action").show(); 
    }, 
    function(){ 
     if($(".img-action:hover").length == 0) { 
     $(".img-action").hide(); 
     } 
    } 
); 
0
try{ 
    jQuery('body').live('click', function(){ 
    var booleans=0; 
    try{ 
     booleans=jQuery("#loginForm:hover").length; 
     //booleans=jQuery('#loginForm').is(':hover'); 
    }catch(e){} 
    if(booleans==0){ 
     document.getElementById("d1").style.display = 'none'; 
    } 
    });  
}catch(e){}