css3动画+盒子阴影在Safari中不起作用;歌剧

时间:2013-02-20 04:44:36

标签: safari css3 css-animations

我已经使用CSS3动画在div中实现了盒子阴影效果...代码在firefox和chrome中运行良好但我不知道为什么我的代码在Safari和Opera中不起作用...

Safari版我正在使用5.1.7 ...

和Opera Version 12.12 ......

JsFiddle Link

我的代码:

@-moz-keyframes glowz {
 0%     {  -moz-box-shadow:0px 0px 10px 10px rgba(64,142,0,1);  }
 33%    {  -moz-box-shadow:0px 0px 7px 7px rgba(64,142,0,1);  }
 66%    {  -moz-box-shadow:0px 0px 2px 2px rgba(64,142,0,1);  }
 100%   {  -moz-box-shadow:0px 0px 9px 9px rgba(64,142,0,1);  }
}
@-webkit-keyframes glowz {
 0%     {  -webkit-box-shadow:0px 0px 10px 10px rgba(64,142,0,1);  }
 33%    {  -webkit-box-shadow:0px 0px 7px 7px rgba(64,142,0,1);  }
 66%    {  -webkit-box-shadow:0px 0px 2px 2px rgba(64,142,0,1);  }
 100%   {  -webkit-box-shadow:0px 0px 9px 9px rgba(64,142,0,1);  }
}
@-o-keyframes glowz {
 0%     {  -o-box-shadow:0px 0px 10px 10px rgba(64,142,0,1);  }
 33%    {  -o-box-shadow:0px 0px 7px 7px rgba(64,142,0,1);  }
 66%    {  -o-box-shadow:0px 0px 2px 2px rgba(64,142,0,1);  }
 100%   {  -o-box-shadow:0px 0px 9px 9px rgba(64,142,0,1);  }
}
@keyframes glowz {
 0%     {  box-shadow:0px 0px 10px 10px rgba(64,142,0,1);  }
 33%    {  box-shadow:0px 0px 7px 7px rgba(64,142,0,1);  }
 66%    {  box-shadow:0px 0px 2px 2px rgba(64,142,0,1);  }
 100%   {  box-shadow:0px 0px 9px 9px rgba(64,142,0,1);  }
}

.blinker {
    background-color: #FF0000;
    display: block;
    height: 27px;
    position: absolute;
    width: 27px;
    left:50%; top:50%;
    border-radius: 5em; -webkit-border-radius: 5em; -moz-border-radius: 5em; -o-border-radius: 5em;

    -ms-animation: 5s ease-in-out 0s alternate none infinite glowz;
    -webkit-animation: 5s ease-in-out 0s alternate none infinite glowz;
    -moz-animation: 5s ease-in-out 0s alternate none infinite glowz;
    -o-animation: 5s ease-in-out 0s alternate none infinite glowz;
    animation: 5s ease-in-out 0s alternate none infinite glowz;

}

css3动画在safari和opera中是否有错误?

1 个答案:

答案 0 :(得分:1)

稍微调整一下你的CSS,它会起作用。

替换以下代码:

    -ms-animation: 5s ease-in-out 0s alternate none infinite glowz;
    -webkit-animation: 5s ease-in-out 0s alternate none infinite glowz;
    -moz-animation: 5s ease-in-out 0s alternate none infinite glowz;
    -o-animation: 5s ease-in-out 0s alternate none infinite glowz;
    animation: 5s ease-in-out 0s alternate none infinite glowz;

使用以下代码:

    -webkit-animation-name: glowz;
    -webkit-animation-duration: 5s;
    -webkit-animation-timing-function: ease-in-out;
    -webkit-animation-iteration-count: infinite;
    -webkit-animation-direction: alternate;
    -webkit-animation-delay: 0;
    -webkit-animation-fill-mode: none;

    -moz-animation-name: glowz;
    -moz-animation-duration: 5s;
    -moz-animation-timing-function: ease-in-out;
    -moz-animation-iteration-count: infinite;
    -moz-animation-direction: alternate;
    -moz-animation-delay: 0;
    -moz-animation-fill-mode: none;

    -o-animation-name: glowz;
    -o-animation-duration: 5s;
    -o-animation-timing-function: ease-in-out;
    -o-animation-iteration-count: infinite;
    -o-animation-direction: alternate;
    -o-animation-delay: 0;
    -o-animation-fill-mode: none;

    animation-name: glowz;
    animation-duration: 5s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
    animation-delay: 0;
    animation-fill-mode: none;

DEMO