Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS transition or animation not working in phonegap

I need to animate a <div>. Tried using @keyframes and transition. Here's a code:

TRANSITION

#menu{
...
width:70%;
-webkit-transition: width 5s;
..
}

KEYFRAMES

#menu{
    ...
    width:70%;
    animation: menuEffect 3s;
    ..
    }
@keyframes menuEffect
{
from {width:0%;}
to {width:70%;}
}

I'm using cordova/phonegap 2.0.0 and targeting android 4.0 and above. I do not see this working. Does transition and animation not support phonegap? Please assist.

like image 204
Sujit Y. Kulkarni Avatar asked Apr 19 '13 18:04

Sujit Y. Kulkarni


1 Answers

Just don't forget to prepend -webkit- to the css properties. It fixed all the problems for me.

This code worked in my case:

/* 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);
    }
}

You can also use 'from, to' and it would just work fine.

like image 186
K.K Avatar answered Nov 15 '22 06:11

K.K