views:

27

answers:

3

Hi, i have a jQuery line that execute 2 animations, what i want is to remove the #flasher DIV after sliding it up by my current code. How to add a callback in this bunch of brackets?

here is my code:

$("#flasher").animate({opacity: 1.0}, 6000).animate({"top": "-=30px"},"slow");

Thanks

+1  A: 
$("#flasher").animate({opacity: 1.0}, 6000)
.animate({"top": "-=30px"},"slow",function(){
    $(this).remove();
});
PetersenDidIt
A: 

You need to add callback function as the next parameter in last call to animate. The animate api page has some examples.

Giorgi
+1  A: 

this should to it

$("#flasher").animate({opacity: 1.0}, 6000).animate({"top": "-=30px"},"slow", function() {
    $("#flasher").remove();
});
Tim