我使用JS和CSS创建了调用动画.我在大多数浏览器中进行了测试,并且工作正常.但不幸的是,阴影效果不支持IE.
我在IE 11中进行了测试.我添加了其他CSS,以在所有浏览器上工作.但是,IE中不支持动画功能,我无法解决此问题.请运行以下代码并为我提供帮助.
var setRinging = function() {
setTimeout(function() {
$(".ringing").addClass("-ringing");
},600);
};
setRinging();
a {
cursor: pointer;
}
.h-list,.actions {
margin: 0;
padding: 0;
list-item-style: none;
}
.h-list>li,.actions>li {
display: inline-block;
}
.container {
position: relative;
width: 350px;
margin: 50px auto;
-webkit-perspective: 600px;
perspective: 600px;
}
.call {
position: absolute;
width: 100%;
Box-sizing: border-Box;
color: #0b5d4c;
padding: 15px;
border-radius: 4px;
transition: all 1s,background-color 600ms,opacity 600ms;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.ringing {
z-index: 10;
background-color: #1ab394;
}
/* inner */
.head {
font-size: 42px;
text-align: center;
margin: 0 auto;
}
.details {
color: #ecf0f1;
text-align: center;
font-size: 20px;
padding: 20px 0px 5px;
}
.details2 {
color: #d6fff6;
text-align: center;
font-size: 20px;
padding: 0px 0px 15px;
}
.actions {
width: 100%;
padding: 2px 16px;
Box-sizing: border-Box;
text-align: center;
}
.action {
padding: 0 8px 0 12px;
Box-sizing: border-Box;
}
.action>a {
width: 100%;
text-align: center;
display: inline-block;
Box-sizing: border-Box;
padding: 5px 8px;
text-decoration: none;
font-size: 15px;
border-radius: 4px;
background-color: white;
color: #1ab393;
}
.action>a:hover {
background-color: rgba(255,255,0.8);
}
/* animation */
.-fadeout {
-webkit-filter: blur(6px);
filter: blur(6px);
opacity: 0;
}
.-drop {
-webkit-filter: blur(6px);
filter: blur(6px);
opacity: 0;
-webkit-transform: translateY(20%) rotateX(20deg);
transform: translateY(20%) rotateX(20deg);
}
.-flip {
-webkit-transform: rotateY(180deg);
transform: rotateY(180deg);
}
.flipback {
-webkit-transform: rotateY(-180deg);
transform: rotateY(-180deg);
}
.-ringing {
-webkit-animation: _ringing 800ms infinite;
animation: _ringing 800ms infinite;
-webkit-animation-fill-mode: forward;
animation-fill-mode: forward;
-webkit-animation-direction: normal;
animation-direction: normal;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
}
@-webkit-keyframes _ringing {
0% {
-webkit-transform: translate(0,0);
transform: translate(0,0);
}
10% {
-webkit-transform: translate(6px,0px);
transform: translate(6px,0px);
-webkit-transform: rotateZ(2deg);
transform: rotateZ(2deg);
}
20% {
-webkit-transform: translate(-6px,0px);
transform: translate(-6px,0px);
-webkit-transform: rotateZ(-2deg);
transform: rotateZ(-2deg);
}
30% {
-webkit-transform: translate(3px,0px);
transform: translate(3px,0px);
-webkit-transform: rotateZ(1deg);
transform: rotateZ(1deg);
}
40% {
-webkit-transform: translate(-3px,0px);
transform: translate(-3px,0px);
-webkit-transform: rotateZ(-1deg);
transform: rotateZ(-1deg);
}
50% {
-webkit-transform: translate(2px,0px);
transform: translate(2px,0px);
-webkit-transform: rotateZ(1deg);
transform: rotateZ(1deg);
}
60% {
-webkit-transform: translate(0,0);
}
100% {
-webkit-transform: translate(0,0);
}
}
@keyframes _ringing {
0% {
-webkit-transform: translate(0,0);
}
}
/* eq */
.hidden {
display: none;
}
.sound {
font-size: 26px;
position: absolute;
top: -6px;
right: -6px;
opacity: .2;
cursor: pointer;
}
.sound:hover {
opacity: .5;
}
.fa-ban {
color: tomato;
}
.head {
height: 46px;
}
#eq {
width: 220px;
height: 46px;
}
.call-animation {
position: relative;
margin: 0 auto;
-webkit-animation: play 2s ease infinite;
/* Safari 4+ */
-moz-animation: play 2s ease infinite;
/* Fx 5+ */
-o-animation: play 2s ease infinite;
/* Opera 12+ */
animation: play 2s ease infinite;
/* IE 10+,Fx 29+ */
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
min-height: 209px;
background-color: #1ab393;
border-radius: 5px;
}
@-webkit-keyframes play {
0% {
transform: scale(1);
}
15% {
Box-shadow: 0 0 0 5px rgba(26,179,147,0.4);
}
25% {
Box-shadow: 0 0 0 10px rgba(26,0.4),0 0 0 20px rgba(26,0.2);
}
25% {
Box-shadow: 0 0 0 15px rgba(26,0 0 0 30px rgba(26,0.2);
}
}
@-moz-keyframes play {
0% {
transform: scale(1);
}
15% {
Box-shadow: 0 0 0 5px rgba(26,0.2);
}
}
@-o-keyframes play {
0% {
transform: scale(1);
}
15% {
Box-shadow: 0 0 0 5px rgba(26,0.2);
}
}
@keyframes play {
0% {
transform: scale(1);
}
15% {
Box-shadow: 0 0 0 5px rgba(26,0.2);
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div class="container">
<div class="call-animation">
<div class="call ringing">
<div class="head"><i class="fa fa-bell"></i></div>
<div class="details">+912 345 678 912 is calling...</div>
<div class="details2">User Name</div>
<ul class="actions">
<li class="action"><a id="accept" href="#">View Details</a></li>
</ul>
</div>
</div>
</div>
振动效果在IE中起作用,但背景阴影动画在IE中不起作用.请检查图像.
最佳答案
只是设置Box-shadow:最初没有设置.完整的代码如下
<html lang="en">
<head>
<Meta charset="UTF-8">
<Meta name="viewport" content="width=device-width,initial-scale=1.0">
<Meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<style>
a {
cursor: pointer;
}
.h-list,Fx 29+ */
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
min-height: 209px;
background-color: #1ab393;
border-radius: 5px;
Box-shadow:none;
}
@-webkit-keyframes play {
0% {
transform: scale(1);
}
15% {
Box-shadow: 0 0 0 5px rgba(26,0.4);
-webkit-Box-shadow: 0 0 0 5px rgba(26,0.4);
-ms-Box-shadow: 0 0 0 5px rgba(26,0.4);
-moz-Box-shadow: 0 0 0 5px rgba(26,0.2);
-webkit-Box-shadow: 0 0 0 10px rgba(26,0.2);
-ms-Box-shadow: 0 0 0 10px rgba(26,0.2);
-moz-Box-shadow: 0 0 0 10px rgba(26,0.2);
-webkit-Box-shadow:0 0 0 15px rgba(26,0.2);
-ms-Box-shadow: 0 0 0 0 0 0 15px rgba(26,0.2);
-moz-Box-shadow: 0 0 0 15px rgba(26,0.2);
}
}
</style>
</head>
<body>
<div class="container">
<div class="call-animation">
<div class="call ringing">
<div class="head"><i class="fa fa-bell"></i></div>
<div class="details">+912 345 678 912 is calling...</div>
<div class="details2">User Name</div>
<ul class="actions">
<li class="action"><a id="accept" href="#">View Details</a></li>
</ul>
</div>
</div>
</div>
<script>
var setRinging = function() {
setTimeout(function() {
$(".ringing").addClass("-ringing");
},600);
};
setRinging();
</script>
</body>
</html>