css3动画不工作在chrome [英] css3 animation not working in chrome
本文介绍了css3动画不工作在chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个小动画,在firefox工作,但不是在webkit浏览器。也许有人看到的错误,因为我已经找了一个小时...它是一个impress.js演示文稿的一部分,类似于prezi。
谢谢!
css:
#its。 step.present h5 {
display:inline-block;
position:absolute;
动画:aia2 5s linear infinite alternate;
-moz-animation:aia2 5s linear无限替代;
-webkit-animation:aia2 5s linear无限替代;
-ms-animation:aia2 5s线性无限替换;
-o-animation:aia2 5s linear无限替代;
-moz-animation-delay:4s;
-webkit-animation-delay:4s;
-ms-animation-delay:4s;
-o-animation-delay:4s;
animation-delay:4s;
}
@ -moz-keyframes aia2 {
0%{
left:120px;
-moz-transform:scale(1)rotate(0deg);
-webkit-transform:scale(1)rotate(0deg);
-ms-transform:scale(1)rotate(0deg);
-o-transform:scale(1)rotate(0deg);
transform:scale(1)rotate(0deg);
color:red;
}
90%{
left:580px;
-moz-transform:scale(1)rotate(2000deg);
-webkit-transform:scale(1)rotate(2000deg);
-ms-transform:scale(1)rotate(2000deg);
-o-transform:scale(1)rotate(2000deg);
transform:scale(1)rotate(2000deg);
}
100%{
left:580px;
}
}
html: / p>
< div id =itsclass =stepdata-x =850data-y =3000 data-rotate =90data-scale =5>
< p>
< ul>
< li> Web开发,< / li>
< li>网页设计,< / li>
< li> Log< h5> o< / h5>& nbsp;& nbsp;设计,< / li>
< li>网络营销,< / li>
< / ul>
< ul class =doua>
< li>< h6> e< / h6>& nbsp;& nbsp; Commerce,< / li>
< li> CMS(WP,J,D),< / li>
< li> Cust& nbsp; m Apps< / li>
< li>和其他人。< / li>
< / ul>
< / p>
< / div>
解决方案
-moz-animation:aia2 5s linear无限替代;
-ms-animation:aia2 5s线性无限替换;
-o-animation:aia2 5s linear无限替代;
动画:aia2 5s linear无限替代; / * this come last * /
由于你有 -webkit- :aia2
, -moz-animation:aia2
等,你必须为每个浏览器设置动画:
@ - moz-keyframes aia2 {
...
}
@ -webkit-keyframes aia2 {
...
}
@ -o-keyframes aia2 {
...
}
I have a small animation that is working in firefox, but not in webkit browsers. Maybe someone sees the mistake cause i've looked for an hour... It is part of a impress.js presentation, similar to prezi. Thanks!
css:
#its.step.present h5{
display: inline-block;
position:absolute;
animation: aia2 5s linear infinite alternate;
-moz-animation: aia2 5s linear infinite alternate;
-webkit-animation: aia2 5s linear infinite alternate;
-ms-animation: aia2 5s linear infinite alternate;
-o-animation: aia2 5s linear infinite alternate;
-moz-animation-delay: 4s;
-webkit-animation-delay: 4s;
-ms-animation-delay: 4s;
-o-animation-delay: 4s;
animation-delay: 4s;
}
@-moz-keyframes aia2{
0%{
left:120px;
-moz-transform:scale(1) rotate(0deg);
-webkit-transform:scale(1) rotate(0deg);
-ms-transform:scale(1) rotate(0deg);
-o-transform:scale(1) rotate(0deg);
transform:scale(1) rotate(0deg);
color: red;
}
90%{
left: 580px;
-moz-transform:scale(1) rotate(2000deg);
-webkit-transform:scale(1) rotate(2000deg);
-ms-transform:scale(1) rotate(2000deg);
-o-transform:scale(1) rotate(2000deg);
transform:scale(1) rotate(2000deg);
}
100%{
left: 580px;
}
}
html:
<div id="its" class="step" data-x="850" data-y="3000" data-rotate="90" data-scale="5">
<p>
<ul>
<li>Web Development,</li>
<li>Web Design,</li>
<li>Log<h5>o</h5> Design,</li>
<li>Web Marketing,</li>
</ul>
<ul class="doua">
<li><h6>e</h6> Commerce,</li>
<li>CMS (WP, J, D),</li>
<li>Cust m Apps</li>
<li>and others.</li>
</ul>
</p>
</div>
解决方案
You have to put the general animation rule after the browser specific ones:
-webkit-animation: aia2 5s linear infinite alternate;
-moz-animation: aia2 5s linear infinite alternate;
-ms-animation: aia2 5s linear infinite alternate;
-o-animation: aia2 5s linear infinite alternate;
animation: aia2 5s linear infinite alternate; /* this comes last */
And since you have -webkit-animation: aia2
, -moz-animation: aia2
etc. you have to set the animation for each browser like:
@-moz-keyframes aia2{
...
}
@-webkit-keyframes aia2{
...
}
@-o-keyframes aia2{
...
}
这篇关于css3动画不工作在chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文