2011-09-30 38 views
4

以下CSS在Webkit中正常工作。沒有在Opera中檢查過它,但我知道它不適用於Firefox。有人可以告訴我爲什麼嗎?-moz-animation爲什麼不起作用?

正確的類肯定會應用到我的HTML(使用Firebug檢查它,並且我確實在.arrow上看到-moz-animation: 500ms ease 0s normal forwards 1 arrowRotateDot屬性)。

這也不適用於IE9,雖然我原本有-ms-animation:...-ms-transform:...。我認爲它應該在IE9中工作,但當它不是我只是假設IE不支持這些。但是,既然它不在Firefox中工作,也許其他事情正在發生。

.page.updatesPodcasts > .mainContent > .content .contentUpdates .disc.dot .dvd .arrow { 
    -webkit-animation: arrowRotateDot 500ms forwards; 
    -moz-animation: arrowRotateDot 500ms forwards; 
    -o-animation: arrowRotateDot 500ms forwards; 
    animation: arrowRotateDot 500ms forwards; 
} 
.page.updatesPodcasts > .mainContent > .content .contentUpdates .disc.f2 .dvd .arrow { 
    -webkit-animation: arrowRotateF2 500ms forwards; 
    -moz-animation: arrowRotateF2 500ms forwards; 
    -o-animation: arrowRotateF2 500ms forwards; 
    animation: arrowRotateF2 500ms forwards; 
} 

@-webkit-keyframes arrowRotateDot { 
    100% { 
     left:-18px; top:182px; 
     -moz-transform: scale(1) rotate(-30deg); 
     -webkit-transform: scale(1) rotate(-30deg); 
     -o-transform: scale(1) rotate(-30deg); 
     transform: scale(1) rotate(-30deg); 
     } 
} 
@-webkit-keyframes arrowRotateF2 { 
    0% { 
     left:-18px; top:182px; 
     -moz-transform: scale(1) rotate(-30deg); 
     -webkit-transform: scale(1) rotate(-30deg); 
     -o-transform: scale(1) rotate(-30deg); 
     transform: scale(1) rotate(-30deg); 
     } 
    100% { 
     left:115px; top:257px; 
     -moz-transform: scale(1) rotate(-90deg); 
     -webkit-transform: scale(1) rotate(-90deg); 
     -o-transform: scale(1) rotate(-90deg); 
     transform: scale(1) rotate(-90deg); 
     } 
} 

回答

9

您的動畫不能在Firefox的工作,因爲你正在使用@ - 的webkit -keyframes,僅適用於WebKit瀏覽器,即Chrome和Safari。 (某種程度上)跨瀏覽器做動畫關鍵幀的方法是:

@keyframes animationName { 
    /* animation rules */ 
} 

@-moz-keyframes animationName { 
    /* -moz-animation rules */ 
} 

@-webkit-keyframes animationName { 
    /* -webkit-animation rules */ 
} 

Opera和Internet Explorer目前不支持@keyframes規則。

+0

咄。謝謝:) – maxedison

+0

Internet Explorer 10支持'@keyframes'規則。 (不使用'-ms-'前綴) –

0

天際線是正確的。 Firefox不支持這一點,所以如果沒有webkit的話,你需要額外的代碼來獲得相同或相似的效果。

此外,這裏有一些額外的信息,可能會幫助你與你的代碼或幫助你決定從這一點,你的代碼去哪裏如果添加額外的代碼是不是一個選項(我最終改變了我如何代碼保留從是與代碼不知所措):

http://caniuse.com/#

http://www.quirksmode.org/webkit.html