Is there any way i can animate a div using percentages with jquery?
I’ve tried these:
$('.box1').animate({width:($(".wrapper").width()*.100)},"fast");})
$('.box1').animate({width:'100%'},"fast");})
$('.box1').animate({width:100%;})
none of the above work…
any ideas?
UPDATE
var p_e_h= 1.0;
var p_e_w= 1.0;
$('.box1').animate({width:($(".wrapper").width()* p_e_w)},"fast");
$('.box1').animate({height:($(".wrapper").height()* p_e_h)},"fast");
width works, but height does not. Unless i click the button again.
Should work fine.
Update
Since you are doing 2 different
.animatecalls, the animations are queued and executed sequentially. Just do them with the same animation call:Example of it working: jsFiddle