2013-05-07 60 views
0

我有一个内置div与悬停()函数附加到它。IE浏览器 - jquery悬停()只有第一次作品

它在FF,Chrome中正常工作。

这个问题是在IE浏览器,第一次它的作品第二次我没有看过div。

HTML:

<div id="mini-cart-li" class=""> 
    <a class="heading" href="http://mb.local.com/checkout/cart/" title="View contents of your shopping cart">My Cart 
    </a> 
    <div id="mini-cart-content" class="block block-cart block-content" style="display: none;"> 
     BLA BLA BLA BLA BLA .... 
     </div> 
     </div> 

JS:

jQuery(document).ready(function() { 

    jQuery("#mini-cart-li").hover(
     function() { 
      // jQuery(this).addClass('hover'); 
      jQuery("#mini-cart-content").stop(true, true).animate({opacity: "show", display: "block"}, "slow"); 
     }, 
     function() { 
     // jQuery(this).removeClass('hover'); 
      jQuery("#mini-cart-content").stop(true, true).animate({opacity: "hide", display: "none"}, "slow"); 
     } 
    ) 
}); 
+0

你错过了**;最后** **之前)**; **。 [链接](http://jsfiddle.net/4uHuH/) – Vucko 2013-05-07 08:00:37

+0

使用IE版本? – 2013-05-07 08:25:27

回答

0

尝试使用这种

$('#mini-cart-content').stop(true, true).animate({ opacity: "show" }, "slow"); 

    $("#mini-cart-content").stop(true, true).animate({ opacity: "hide" }, "slow"); 
+0

这工作得很好,所以问题主要是animate()而不是hover() – WonderLand 2013-05-07 08:55:03

2

尝试使用数量不透明度值,而不是showhide

jQuery("#mini-cart-li").hover(
    function() { 
     // jQuery(this).addClass('hover'); 
     jQuery("#mini-cart-content").stop(true, true).animate({opacity: 1, display: "block"}, "slow"); 
    }, 
    function() { 
    // jQuery(this).removeClass('hover'); 
     jQuery("#mini-cart-content").stop(true, true).animate({opacity: 0, display: "none"}, "slow"); 
    } 
) 
相关问题