我有一點CSS3動畫,它完美支持除Safari瀏覽器之外的所有支持CSS3的瀏覽器。奇怪是不是?確定這裏是我的代碼:CSS3動畫無法在safari中工作
HTML
<div class="right">
<div class="key-arm"><img src="images/landing/key-arm.png" alt="arm" /></div>
</div>
CSS
.landing .board .right {
width: 291px;
height: 279px;
background: url('../images/landing/key-pnl.png');
bottom: 16px;
right: 250px;
position: absolute;
}
.landing .board .right .key-arm {
position: absolute;
left: 44px;
top: 18px;
width: 41px;
height: 120px;
}
/*=== Key Arm Animation ===*/
@-webkit-keyframes keyarm {
0% { -webkit-transform: rotate(0deg); }
5% { -webkit-transform: rotate(-14deg); }
10% { -webkit-transform: rotate(0deg); }
}
@-moz-keyframes keyarm {
0% { -moz-transform: rotate(0deg); }
5% { -moz-transform: rotate(-14deg); }
10% { -moz-transform: rotate(0deg); }
}
@-ms-keyframes keyarm {
0% { -ms-transform: rotate(0deg); }
5% { -ms-transform: rotate(-14deg); }
10% { -ms-transform: rotate(0deg); }
}
@-o-keyframes keyarm {
0% { -o-transform: rotate(0deg); }
5% { -o-transform: rotate(-14deg); }
10% { -o-transform: rotate(0deg); }
}
@keyframes keyarm{
0% { transform: rotate(0deg); }
5% { transform: rotate(-14deg); }
10% { transform: rotate(0deg); }
}
.right .key-arm{
-webkit-transform-origin: 12px 105px;
-moz-transform-origin: 12px 105px;
-ms-transform-origin: 12px 105px;
-o-transform-origin: 12px 105px;
transform-origin: 12px 105px;
-webkit-animation: keyarm 8s ease-in-out 0s infinite;
-moz-animation: keyarm 8s ease-in-out 4s infinite;
-ms-animation: keyarm 8s ease-in-out 4s infinite;
-o-animation: keyarm 8s ease-in-out 4s infinite;
animation: keyarm 8s ease-in-out 0s infinite;
}
確定這不會在Safari正如我所說的,有沒有任何動靜工作。
另外,只有在Safari中,鍵臂div才顯示,只有當您調整屏幕大小!它在DOM中,但由於某種原因,它不顯示!
我在做什麼錯?
感謝
莫羅
UPDATE:從你的答案好吧,我得到了@keyframes不支持在Safari 4,這是奇怪,因爲在同一頁我用@keyframes的作品的動畫吧!
這裏的CSS代碼:
.board .rays{
background: url("../images/landing/rays.gif") no-repeat 0 0 red;
height: 381px;
left: 251px;
opacity: 1;
top: 80px;
width: 408px;
position: absolute;
}
.board .bottle{
background: url("../images/landing/bottle.gif") no-repeat 0 0 lime;
bottom: 30px;
height: 405px;
left: 276px;
width: 357px;
z-index: 1;
position:absolute;
}
/*=== Rays Animation ===*/
@-webkit-keyframes rays{
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
@-moz-keyframes rays{
0% { -moz-transform: rotate(0deg); }
100% { -moz-transform: rotate(360deg); }
}
.board .rays{
-webkit-animation: rays 40s linear 0s infinite;
-moz-animation: rays 40s linear 0s infinite;
animation: rays 40s linear 0s infinite;
}
和HTML:
<div class="board">
<div class="rays"></div>
<div class="bottle"></div>
</div>
試一試在的jsfiddle(如果你使用Safari 4),你會看到
你能做一個jsfiddle? HTTP://的jsfiddle。淨/ – 2012-02-09 13:02:27
它來:http://jsfiddle.net/zalun/E4mz9/我還沒有在Safari中測試它。 – Mauro74 2012-02-09 13:14:34
http://jsfiddle.net/E4mz9/14/下面是正確的鏈接,對不起!順便說一句,在Safari中無法正常工作,只是測試 – Mauro74 2012-02-09 13:17:57