2012-08-07 106 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