1

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

我正在使用 5.1.7 的 Safari 版本...

和 Opera 版本 12.12...

JsFiddle 链接

我的代码:

@-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;

}

safari 和 opera 中的 css3 动画有问题吗?

4

1 回答 1

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;

演示

于 2013-02-20T05:11:05.323 回答