rstacruz / jquery.transit

Super-smooth CSS3 transformations and transitions for jQuery
http://ricostacruz.com/jquery.transit
7.3k stars 864 forks source link

Transition by percentage ? #219

Open daslicht opened 9 years ago

daslicht commented 9 years ago

Hi, is it possible to use percentage instead of pixels ? I tried something like this , but that did not work:

$(".box").transition({ left: 20% });
//or
$(".box").transition({ left: '20%' });

The latter moves the object but without animation?

victorluissantos commented 9 years ago

hi, try this cody $( ".box" ).animate({ "left": "+=20%" }, "slow" );

tezma90 commented 9 years ago

you can use variables instead

var temp=your*width; //window.innerWidth

$(".box").transition({ left: temp/5 });