panthro
panthro

Reputation: 24061

Animation on a HTML5 mobile site

I'm making a mobile website and I'm using javascript to animate things around? Is this recommended or should I use CSS3 transitions?

If so how can I implement a simple CSS3 transition that will move divA down 20px when divA is clicked?

Thanks.

Upvotes: 2

Views: 2952

Answers (2)

Mircea
Mircea

Reputation: 11593

Please do not use jQuery + a plugin just to move down a div on a mobile device. CSS3 transitions and animations are very well supported on mobile devices, on some of them even hardware accelerated.

Here is a simple script that does what you need: http://jsfiddle.net/3Sd4U/

Upvotes: 0

will
will

Reputation: 4575

You need to use a combination of javascript and CSS. CSS for the animations and javascript to trigger them.

Take a look at this jQuery plugin: http://ricostacruz.com/jquery.transit/

I've been using it recently and it is very useful, especially for callbacks.

Hope that helps :)

Upvotes: 4

Related Questions