Reputation: 13506
I'd like to apply animate()
and slideUp()
functions to the same element. Both functions would start at the same time but would end at different times. How can I achieve that?
If I do
$(el).animate(200);
$(el).slideUp(2000);
The slideUp
function waits for animate
function to finish.
Thanks
Upvotes: 0
Views: 5363
Reputation: 369
To run two fx at the same time, you can pass "queue: false" as an argument like this:
HTML:
<div class="el"></div>
CSS:
.el {
height: 100px;
width: 100px;
border: 1px solid black;
position: relative;
}
Javascript:
$('.el')
.animate({'left' : '100px'}, 500)
.slideUp({duration: 1000, queue: false});
This code will slide the element right for .5 seconds, while at the same time sliding it up for 1 second. Here's a jsfiddle showing this: http://jsfiddle.net/cWLvc/
Upvotes: 2