我需要为 <div>
制作动画.尝试使用@keyframes 和过渡。
这是一个代码:
过渡
#menu{
...
width:70%;
-webkit-transition: width 5s;
..
}
关键帧
#menu{
...
width:70%;
animation: menuEffect 3s;
..
}
@keyframes menuEffect
{
from {width:0%;}
to {width:70%;}
}
我正在使用 cordova/phonegap 2.0.0 并针对 android 4.0 及更高版本。 我没有看到这个工作。过渡和动画不支持phonegap吗?请协助。
最佳答案
只是不要忘记将 -webkit-
添加到 css 属性。它为我解决了所有问题。
此代码适用于我的情况:
/* Animation element id */
#animate {
position: absolute;
top: 100px;
left: 100px;
-webkit-animation: move 1s ease infinite;
}
@-webkit-keyframes move {
50% {
-webkit-transform: translate(100px, 100px);
}
}
您也可以使用“从,到”,它会很好用。
关于android - CSS 过渡或动画在 phonegap 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16111261/