【发布时间】:2016-06-26 15:57:48
【问题描述】:
我有以下 CSS 代码,它是一个很好的声纳效果,应用于悬停时的元素。它在 Firefox、Opera 和 Chrome 中运行良好 但我也不能让它在 IE(10+) 和 Edge 中工作。
body {
background-color: #cccccc;
}
.text {
position: realtive;
display: block;
width: 85px;
margin: 150px auto 0px;
background-color: #;
}
.content {
display: block;
position: relative;
height: 100px;
width: 100px;
border: 2px solid white;
border-radius: 100%;
margin: 20px auto;
}
.icon {
display: block;
height: 100px;
width: 100px;
background-color: red;
}
.whiteSonarEffect .icon {
border-radius: 100%;
position: relative;
}
.whiteSonarEffect .icon:after {
position: absolute;
width: 100%;
height: 100%;
border-radius: 100%;
content:'';
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
top: 0;
left: 0;
}
.whiteSonarEffect .icon:hover {
color: #fff;
}
.whiteSonarEffect .content:hover .icon:after {
-webkit-animation: whiteSonarEffect 1.3s ease-out 75ms;
-moz-animation: whiteSonarEffect 1.3s ease-out 75ms;
-o-animation: whiteSonarEffect 1.3s ease-out 75ms;
animation: whiteSonarEffect 1.3s ease-out 75ms;
}
@-webkit-keyframes whiteSonarEffect {
0% {
opacity: 0.3;
}
40% {
opacity: 0.5;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
}
100% {
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
-webkit-transform: scale(1.5);
opacity: 0;
}
}
@-moz-keyframes whiteSonarEffect {
0% {
opacity: 0.3;
}
40% {
opacity: 0.5;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
}
100% {
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
-moz-transform: scale(1.5);
opacity: 0;
}
}
@-o-keyframes whiteSonarEffect {
0% {
opacity: 0.3;
}
40% {
opacity: 0.5;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
}
100% {
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
-o-transform: scale(1.5);
opacity: 0;
}
}
@keyframes whiteSonarEffect {
0% {
opacity: 0.3;
}
40% {
opacity: 0.5;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
}
100% {
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 10px 10px #fff, 0 0 0 10px rgba(255, 255, 255, 0.5);
transform: scale(1.5);
opacity: 0;
}
}
<div class="whiteSonarEffect">
<div class="text"><h3>Hover Me</h3></div>
<div class="content">
<div class="icon"></div>
</div>
</div>
您可以在 CodePen 上查看:http://codepen.io/ivanchi/pen/YWNjVN 如有任何建议,将不胜感激。
【问题讨论】:
标签: css internet-explorer css-animations microsoft-edge