为什么电脑端设置的动画,预览和在手机动,不动

如题所述

,这个问题应该是css兼容性问题导致的。目前绝大部分移动浏览器还不支持animation这个属性,而是支持-webkit-animation(这类加前缀的)属性,在问题中:<pre t="code" l="css">.ih { background: #000; opacity:.3;width: 90%; height: 25%; margin-left:-45%; position: absolute;bottom: 120px;left:50%;
animation:ih 2s;
}只设置了,animation: ih 2s; 而没有写兼容的 -webkit-animation: ih 2s;所以动画在移动浏览器中就不动了。你可以试下将上面代码改为:
<pre t="code" l="css">.ih { background: #000; opacity:.3;width: 90%; height: 25%; margin-left:-45%; position: absolute;bottom: 120px;left:50%;
-webkit-animation:ih 2s;
-moz-animation:ih 2s;
-ms-animation:ih 2s;
-o-animation:ih 2s;
animation:ih 2s;
}希望能帮你解决问题,~~
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答