简体   繁体   English

Css Edge动画问题

[英]Css Edge Animation Issue

Every browser works fine apart from Microsoft edge, the animation will only start working if I view the element in edges development window, untick the style for the animation then reapply it ? 除了Microsoft边缘之外,每个浏览器都能正常工作,如果我在边缘开发窗口中查看元素,动画将只开始工作,取消动画的样式然后重新应用它?

@keyframes animatedBackground {
from {background-position: 100% 0;}
to {background-position: 0 0;}
}

#animate-area {
width: 100%;
height: 600px;
position: absolute;
left: 0px;
top: 0px;
z-index: 9;
background-image: url(/images/clouds.png);
background-position: 0px 0px;
background-repeat: repeat-x;
animation: animatedBackground 90s linear infinite;
}

Its really driving me nuts 它真的让我疯狂

Thanks 谢谢

Weirdly IE and Edge need you to state the 0 in the same units as the 100% so you need to use 0%: 奇怪的是IE和Edge需要你以100%的相同单位表示0,所以你需要使用0%:

 @keyframes animatedBackground { from { background-position: 100% 0px; } to { background-position: 0% 0px; } } #animate-area { width: 100%; height: 600px; position: absolute; left: 0px; top: 0px; z-index: 9; background-image: url("https://via.placeholder.com/600x150/"); background-position: 0px 0px; background-repeat: repeat-x; animation: animatedBackground 10s linear infinite; } 
 <div id="animate-area"></div> 

Had a similar issue just now, but for me it did not work when unticking and ticking the box. 刚才有一个类似的问题,但对我而言,在解开盒子并打勾时它不起作用。 Basically had to add a property to the css 基本上不得不向css添加属性

background-origin: border-box;

Hopefully this helps others whom are having a similar issue. 希望这有助于其他有类似问题的人。

@-o-keyframes animatedBackground {
from {background-position: 100% 0;}
to {background-position: 0 0;}
}

@-moz-keyframes animatedBackground {
from {background-position: 100% 0;}
to {background-position: 0 0;}
}

@-webkit-keyframes animatedBackground {
from {background-position: 100% 0;}
to {background-position: 0 0;}
}

@keyframes animatedBackground {
from {background-position: 100% 0;}
to {background-position: 0 0;}
}

#animate-area {
width: 100%;
height: 600px;
position: absolute;
left: 0px;
top: 0px;
z-index: 9;
background-image: url(/images/clouds.png);
background-position: 0px 0px;
background-repeat: repeat-x;
animation: animatedBackground 90s linear infinite;
}

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

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