请你看看这个css snipet,让我知道为什么我无法将跨脉冲和fadeout动画角色添加到跨度?
从技术上讲,我喜欢在一个动画中同时使用或者同时接受脉冲和淡出动画
html,body {
height:100%;
width:100%;
}
#point {
height:100%;
width:100%;
position:relative;
}
.pulse {
position:absolute;
margin:30px;
display: block;
width: 22px;
height: 22px;
border-radius: 50%;
background: #cca92c;
cursor: pointer;
box-shadow: 0 0 0 rgba(204,169,44, 0.4);
animation: pulse 2s infinite;
}
.pulse:hover {
animation: none;
}
@-webkit-keyframes pulse {
0% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-webkit-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
}
100% {
-webkit-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
@keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
box-shadow: 0 0 0 0 rgba(204,169,44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204,169,44, 0);
box-shadow: 0 0 0 10px rgba(204,169,44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204,169,44, 0);
box-shadow: 0 0 0 0 rgba(204,169,44, 0);
}
}
.hideMe {
-webkit-animation: seconds 1.0s forwards;
-webkit-animation-iteration-count: 1;
-webkit-animation-delay: 5s;
animation: seconds 1.0s forwards;
animation-iteration-count: 1;
animation-delay: 5s;
}
@-webkit-keyframes seconds {
0% {
opacity: 1;
}
100% {
opacity: 0;
left: -9999px;
}
}
@keyframes seconds {
0% {
opacity: 1;
}
100% {
opacity: 0;
left: -9999px;
}
}

<span class="pulse hideMe"></span>
&#13;
答案 0 :(得分:1)
.dot {
position: absolute;
margin: 30px;
display: block;
width: 22px;
height: 22px;
border-radius: 50%;
background: #cca92c;
cursor: pointer;
box-shadow: 0 0 0 rgba(204, 169, 44, 0.4);
opacity: 1;
}
.dot--animation {
animation: pulse 2s infinite,
hide .3s forwards 5s;
}
.dot--animation:hover {
animation: none;
}
@keyframes pulse {
0% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0.4);
}
70% {
-moz-box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
box-shadow: 0 0 0 10px rgba(204, 169, 44, 0);
}
100% {
-moz-box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
box-shadow: 0 0 0 0 rgba(204, 169, 44, 0);
}
}
@keyframes hide {
100% {
opacity: 0;
}
}
<div class="dot dot--animation"></div>
答案 1 :(得分:0)
您正在使用。秒动画覆盖.pulse动画。您需要在同一个关键帧集中包含两个动画,或者在animate属性上用逗号分隔关键帧集。或者,您可以使用包装器,将fadeout放在包装器上,将脉冲放在实际跨度上。 Css属性彼此不“堆叠”,它们被后面的实例替换,对于动画也是如此。