2012-08-07 99 views
0

我动画一个div的背景下,以产生你http://farshadzandi.cajQuery的背景动画初始不透明度错在IE仅

代码中看到的黄金按钮效果如下:

$(function(){ 
    $(".navigation").hover(function(){ 
    $(this).children('.background').stop(true,true).animate({opacity: 1},250); 
    }, function(){ 
    $(this).children('.background').stop(true,true).animate({opacity: 0},250); 
    }); 
}); 

$(function(){ 
    $(".lower-navigation").hover(function(){ 
    $(this).children('.lower-background').stop(true,true).animate({opacity: 1},250); 
    }, function(){ 
    $(this).children('.lower-background').stop(true,true).animate({opacity: 0},250); 
    }); 
}); 

灿任何人都可以告诉我为什么虽然这在Firefox/Chrome中工作正常,但它在页面加载时显示IE中的背景图像?谢谢!

回答

1

对于IE,您必须使用以下CSS语法。

/* IE 8 */ 
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; 

/* IE 5-7 */ 
filter: alpha(opacity=50); 
+0

呃,我应该知道的。谢谢!! – 2012-08-08 16:11:14