繁体   English   中英

其他浏览器中的CSS错误

[英]CSS error in other browsers

我将此处的CSS代码用于我的网站加载程序。 我在IE和Mozilla上遇到了问题,一切都没有按照预期的方式进行。

在IE中,没有动画和图形中断,在Mozilla中没有动画,并且图形看起来也不正确。

@bg: #2c3e50;

/*.triangle(@triangle: border-left: 60px solid transparent; 
                     border-right: solid transparent; 
                     border-top: 0 solid transparent;);*/ 



body{
  background: @bg;
}

.loader {
  border-radius: 50%;
  margin: 0 auto;
  position: absolute;
  top: 40%;
  left: 0;
  right: 0;
  height: 50px;
  width: 50px;
}

.tri {
  animation: translateRotation 1.5s infinite reverse;
  -webkit-animation: translateRotation 1.5s infinite reverse;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-top: 0 solid transparent;
  border-bottom: 60px solid #00b4ff;
  width: 0px;
  z-index: 2;
}

.tri2 {
  animation: translateRotation 1.5s infinite;
  -webkit-animation: translateRotation 1.5s infinite;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-top: 0px solid transparent;
  border-bottom: 40px solid #ffde15;
  width: 0px;
  z-index: 1;
}

.tri3 {
   animation: translateRotation 1.5s infinite;
  -webkit-animation: translateRotation 1.5s infinite;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-top: 40px solid #1da158;
  border-bottom: 0px solid transparent;
  width: 0px;
  z-index: 1;
}

.tri4 {
   animation: translateRotation 1.5s infinite reverse;
  -webkit-animation: translateRotation 1.5s infinite reverse;
  border-left: 60px solid transparent;
  border-right: 60px solid transparent;
  border-top: 60px solid #ea343f;
  border-bottom: 0px solid transparent;
  width: 0px;
  z-index: 2;
}

.circ { 
  border: 30px solid rgba(255,255,255,0.1);
}

.circ2 { 
  border: 25px solid rgba(255,255,255,1);
  box-sizing: border-box;
  box-shadow: 0 2px 1px rgba(0,0,0, 0.15), 0 -2px 1px rgba(0,0,0, 0.15), -2px 0 1px rgba(0,0,0, 0.15), 2px 0 1px rgba(0,0,0, 0.15);
  margin-top: 30px;
  z-index: 90;
}
/* ANIMATE */

@-webkit-keyframes translateRotation {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg);}
}

问题是您仅使用@-webkit-keyframes而不是@keyframes-webkit-transform而不是transform ,因为从IE10 +开始,这些前缀不带前缀

您应该在动画关键帧上方添加以下代码,并且应在IE10 +上运行:

@keyframes translateRotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg);}
}

在此处检查keyframe-animation-syntax以查看所有前缀。

对于IE9,您可能应该使用jQuery / jQueryUI之类的Javascript动画,您可以使用Modernizr检查是否有必要使用

if(!Modernizr.cssanimations) {
    // Fallback 
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM