2013-03-03 34 views
2

一個例子上的jsfiddle http://jsfiddle.net/chrisloughnane/T9N3h/IE9瀏覽器是否存在CSS「轉換」?

這個例子正常工作在Opera,Chrome和Firefox,但我無法找到IE的變換。

同樣在Firefox上,當有很多轉換時,所有動畫都會停止。

http://toys.chrisloughnane.net/

有沒有更好的方式來處理呢? TIA。

HTML

<div class="display"></div> 

CSS

.display { 
    background-image: url("http://toys.chrisloughnane.net/images/darkhand-small-50.png"); 
    height: 25px; 
    width: 25px; 
    -webkit-transition:all 400ms; 
    -moz-transition:all 400ms; 
    -o-transition:all 400ms; 
    transition:all 400ms; 
    position: absolute; 
    top: 200px; 
    left: 200px; 
} 

的JavaScript

$(document).ready(function() { 

    function getRandom(min, max) { 
     return min + Math.floor(Math.random() * (max - min + 1)); 
    } 

    function go() { 

     var iCSS = ("rotate(" + getRandom(0, 359) + "deg)"); 

     $(".display").css({ 
      '-moz-transform': iCSS, 
      '-o-transform': iCSS, 
      '-webkit-transform': iCSS 
     }); 

     setTimeout(go, 600); 
    } 

    go(); 

}); 

回答

4

是,IE9支持CSS變換。你只需要添加-ms-前綴。

查看CanIUse website瞭解更多信息。

但是,它不支持Transitions,我在你的CSS代碼中看到了這個問題。如果您需要在IE9(或更早版本)中支持CSS轉換,則可以使用CSS Sandpaper填充庫。

+0

更好的網址:http://caniuse.com/transforms2d(更多信息) – 2013-03-03 21:08:57