手机上的css3动画为什么不动

html-css012

手机上的css3动画为什么不动,第1张

你好,这个问题应该是css兼容性问题导致的。

目前绝大部分移动浏览器还不支持animation这个属性,而是支持-webkit-animation(这类加前缀的)属性,在问题中:

.ih { background: #000 opacity:.3width: 90% height: 25% margin-left:-45% position: absolutebottom: 120pxleft:50%

    animation:ih 2s

}

只设置了,animation: ih 2s而没有写兼容的 -webkit-animation: ih 2s所以动画在移动浏览器中就不动了。你可以试下将上面代码改为:

.ih { background: #000 opacity:.3width: 90% height: 25% margin-left:-45% position: absolutebottom: 120pxleft:50%

    -webkit-animation:ih 2s

    -moz-animation:ih 2s

    -ms-animation:ih 2s

    -o-animation:ih 2s

    animation:ih 2s

}

希望能帮你解决问题,望采纳~~

首先:你可以排除下浏览器兼容的问题,浏览器的兼容是指,IE8以下的浏览器是不兼容CSS3的,目前来说,火狐,谷歌,苹果,ie8以上的浏览器是可以实现的,假设你的浏览器可以属于上面的其中之一,那么第二种可能就是,你自己的代码拼写有错,仔细看代码的编写,有没有出错。有错误则要更正,代码书写一般都要很细心的研磨才可以,不错基本都是可以运行的。

按F12选中class为tpl-scroll js-tpl-scroll-container的DIV删除以后出来载入的div,它的Class是ui-loading。去掉他的display:none属性我们就能看见载入图标了。

-webkit-animation:rotateplane 1.2s infinite ease-in-out

通过这段代码我们能知道这个animation的动画名是rotateplane,在开发者工具中查找相关到文件是showcase_ddb08a6630.css。在源码里面寻找rotateplane关键字能找到以下动画关键帧代码

@-webkit-keyframes rotateplane {

0% {

-webkit-transform: perspective(120px)

}

50% {

-webkit-transform: perspective(120px) rotateY(180deg)

}

100% {

-webkit-transform: perspective(120px) rotateY(180deg) rotateX(180deg)

}

}

将这段代码复制到CSS里面再试试~