We can write a single line of code only if the animation functions are same, like animate( {top: "50px", opacity: 0} ), but how do you perform the animations simultaneously if the animation functions are different, say slide up and animate( {top: "50px"} )?
- possible duplicate of How to run two jQuery animations simultaneously?JJJ– JJJ2011-08-26 11:29:31 +00:00Commented Aug 26, 2011 at 11:29
Add a comment |
1 Answer
When calling to .animate() set the queue value to false, which will cause all animations to run at the same time.
$('div').animate({ opacity: 0.25, height: '400px', }, { queue: false, duration: 5000 }).animate({ width: '500px' }, { queue: false, duration: 5000 }); 2 Comments
Sarthak Gupta
basically I want to use fadeIn and animate so that the element fades into the screen as well as move mhrizontally for which I may change its left position or the margin. I cant seem to get it going... can we specify queue: false in the fadeIn effect also... if we can kindly tell the syntax as I am already using is but cannot get it to work....
Mark Coleman
Simply use
.animate() instead of fadeIn() e.g. .animate({ "opacity": "show"},{queue:false, duration:"slow"});