CSS动画加载器在IE 11中只能正常工作一次

时间:2019-02-19 10:13:19

标签: html css animation internet-explorer-11

CSS加载程序有时在IE 11中无法正常工作。第一次加载页面时,一切正常。但是在第一个正确的装载机之后,装载机显示不正确,只有中央操纵杆改变了装载机的尺寸。似乎:before:after件无法正常工作。如何为IE 11修复它?例如,它在Chrome上运行良好。

.loader {
    background: #1C5685;
    position: relative;
    width: 0.8em;
    height: 4em;
    margin: 250px auto;
    color: #1C5685;
    text-indent: -9999em;
    font-size: 11px;
    -webkit-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-animation: load1 1s infinite ease-in-out;
    animation: load1 1s infinite ease-in-out;
    -webkit-animation-delay: -0.16s;
    animation-delay: -0.16s;
}
.loader:before {
    width: 0.8em;
    height: 4em;
    background: #1C5685;
    content: '';
    position: absolute;
    top: 0;
    left: -1.5em;
    -webkit-animation: load1 1s infinite ease-in-out;
    animation: load1 1s infinite ease-in-out;
    -webkit-animation-delay: -0.32s;
    animation-delay: -0.32s;
}

.loader:after {
    width: 0.8em;
    height: 4em;
    background: #1C5685;
    content: '';
    position: absolute;
    top: 0;
    left: 1.5em;
    -webkit-animation: load1 1s infinite ease-in-out;
    animation: load1 1s infinite ease-in-out;
}

@-webkit-keyframes load1 {
    0%,
    80%,
    100% {
        box-shadow: 0 0;
        height: 4em;
    }
    40% {
        box-shadow: 0 -2em;
        height: 5em;
    }
}

@keyframes load1 {
    0%,
    80%,
    100% {
        box-shadow: 0 0;
        height: 4em;
    }
    40% {
        box-shadow: 0 -2em;
        height: 5em;
    }
}

#loadingDiv {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    opacity: 0.7;
    z-index: 3;
}

工作演示:

.loader {
   background: #1C5685;
   position: relative;
   width: 0.8em;
   height: 4em;
   margin: 250px auto;
   color: #1C5685;
   text-indent: -9999em;
   font-size: 11px;
   -webkit-transform: translateZ(0);
   -ms-transform: translateZ(0);
   transform: translateZ(0);
   -webkit-animation: load1 1s infinite ease-in-out;
   animation: load1 1s infinite ease-in-out;
   -webkit-animation-delay: -0.16s;
   animation-delay: -0.16s;
}

.loader:before {
   width: 0.8em;
   height: 4em;
   background: #1C5685;
   content: '';
   position: absolute;
   top: 0;
   left: -1.5em;
   -webkit-animation: load1 1s infinite ease-in-out;
   animation: load1 1s infinite ease-in-out;
   -webkit-animation-delay: -0.32s;
   animation-delay: -0.32s;
}

.loader:after {
   width: 0.8em;
   height: 4em;
   background: #1C5685;
   content: '';
   position: absolute;
   top: 0;
   left: 1.5em;
   -webkit-animation: load1 1s infinite ease-in-out;
   animation: load1 1s infinite ease-in-out;
}

@-webkit-keyframes load1 {
   0%,
   80%,
   100% {
      box-shadow: 0 0;
      height: 4em;
   }
   40% {
      box-shadow: 0 -2em;
      height: 5em;
   }
}

@keyframes load1 {
   0%,
   80%,
   100% {
      box-shadow: 0 0;
      height: 4em;
   }
   40% {
      box-shadow: 0 -2em;
      height: 5em;
   }
}

#loadingDiv {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: white;
   opacity: 0.7;
   z-index: 3;
}
<div id="loadingDiv">
   <div class="loader">Loading...</div>
</div>

UPD: It was to pulse like this

But it did it like this (only middle stick pulsed)

0 个答案:

没有答案