2012-01-24 85 views
2

有人知道我在哪里可以找到浏览器的表格,以及他们是否支持CSS3动画和关键帧?谢谢CSS3动画支持?

+4

http://caniuse.com/css-animation – BoltClock

+0

不错。谢谢。门将。 –

+0

@BoltClock添加为答案,我会接受。 – henryaaron

回答

-2

编辑:我很抱歉给大家推荐一个W3Schools链接,我永远不会再做。


W3Schools的通常有这些类型的表和信息,看看这个link

它看起来像截至目前,以下浏览器支持CSS动画:

  • 火狐
  • Safari浏览器

而且,离开了孩子,就是目前没有支持它是:

  • IE
  • 歌剧
+0

W3Schools是一个可怕的网站!通常不准确,并且经常过时。 –

+3

@Rich Bradshaw:[你可能喜欢(或见过)](http://meta.stackexchange.com/questions/120025/will-i-be-downvoted-for-giving-a-w3schools-link): P – BoltClock

+0

嗯,很高兴知道。我想我从来没有与他们的信息有任何问题。 – jbranchaud

0

我要去this way。我正在寻找功能检测,而不是寻找浏览器。这个漂亮的写作会为我节省一些工作。所以,我在复制代码,你弄清楚它的含义:-)。

/* Check if the Animation feature exists */ 
if(hasAnimation()) 
{ 
    alert("Has!"); 
    return; 
} 

function hasAnimation() 
{ 
    var elm = document.getElementById('imgDiv') 
     animationstring = 'animation', 
     keyframeprefix = '', 
     domPrefixes = 'Webkit Moz O ms Khtml'.split(' '), 
     pfx = ''; 

    if(elm.style.animationName === undefined) 
    { 
     var animation = false; 
     for(var i = 0; i < domPrefixes.length; i++) 
     { 
      if(elm.style[ domPrefixes[i] + 'AnimationName' ] !== undefined) 
      { 
       pfx = domPrefixes[ i ]; 
       animationstring = pfx + 'Animation'; 
       keyframeprefix = '-' + pfx.toLowerCase() + '-'; 
       animation = true; 
       break; 
      } 
     } 
     if(animation === false) // animate in JavaScript fallback 
      return false; 
    } 

    /* Create animationstring */ 
    elm.style[ animationstring ] = 'rotate 1s linear infinite'; 

    var keyframes = '@' + keyframeprefix + 'keyframes rotate { '+ 
      'from {' + keyframeprefix + 'transform:rotate(0deg) }'+ 
      'to {' + keyframeprefix + 'transform:rotate(360deg) }'+ 
      '}'; 

    /* Add rule to stylesheet */ 
    if(document.styleSheets && document.styleSheets.length) 
    { 
     document.styleSheets[0].insertRule(keyframes, 0); 
     return true; 
    } 

    /* If there is no stylesheet, add rule to header */ 
    var s = document.createElement('style'); 
    s.innerHTML = keyframes; 
    document.getElementsByTagName('head')[ 0 ].appendChild(s); 
    return true; 
} 

更新:为了清晰起见,我重写了代码。另外'elm'元素没有定义。原始演示代码is here