简体   繁体   English

IE9浏览器有CSS'转换'吗?

[英]Is there a CSS 'transform' for IE9 browsers?

An example on jsfiddle http://jsfiddle.net/chrisloughnane/T9N3h/ 关于jsfiddle http://jsfiddle.net/chrisloughnane/T9N3h/的一个例子

This example works fine in opera, chrome and firefox but I can't find a transform for IE. 这个例子在opera,chrome和firefox中工作得很好,但我找不到IE的变换。

Also on Firefox all animation stops when there are a lot of transforms. 同样在Firefox上,当有很多变换时,所有动画都会停止。

http://toys.chrisloughnane.net/ http://toys.chrisloughnane.net/

Is there a better way to approach this? 有没有更好的方法来解决这个问题? tia. TIA。

HTML HTML

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

CSS 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 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();

});

Yes, IE9 supports CSS Transforms. 是的,IE9支持CSS Transforms。 You just have to add the -ms- prefix. 您只需添加-ms-前缀即可。

See the CanIUse website for more info. 有关详细信息,请访问CanIUse网站

It doesn't however, support Transitions, which I see in your CSS code in the question. 但是,它不支持Transitions,我在CSS代码中看到了问题。 If you need to support CSS transitions in IE9 (or earlier), you could use the CSS Sandpaper polyfill library. 如果您需要在IE9(或更早版本)中支持CSS转换,则可以使用CSS Sandpaper polyfill库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM