Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery animate left and scale

Hi I need to scale and animate div left same time.

Something like this.

$('#div').effect('scale'{percent:200},
'animate',{left:200});

Thanks.

This is the solution I found.

 $('#div').effect('scale'{percent:200},1000);
 $('#div').animate({left:100,top:100},1000);
 $('#div').fadeTo(1100,0));
like image 460
Vahan Avatar asked Apr 12 '12 22:04

Vahan


People also ask

Is jQuery slower for animations?

animate() , which is, in fact, very slow. However, JavaScript animation libraries that bypass jQuery deliver incredible performance by avoiding DOM manipulation as much as possible. These libraries can be up to 20 times faster than jQuery.

How do you animate in jQuery?

The jQuery animate() method is used to create custom animations. Syntax: $(selector). animate({params},speed,callback);

What is the correct syntax of animate () method?

The jQuery animate() method provides you a way to create custom animations. Syntax: $(selector). animate({params}, speed, callback);

Can the animate () method be used to animate any CSS property?

The animate() method performs a custom animation of a set of CSS properties. This method changes an element from one state to another with CSS styles. The CSS property value is changed gradually, to create an animated effect. Only numeric values can be animated (like "margin:30px").


1 Answers

$('#div').animate({
   left: 200,
   height: ($(this).height()*2),
   width: ($(this).width()*2)
}, 1000);
like image 146
adeneo Avatar answered Oct 02 '22 22:10

adeneo