简体   繁体   中英

jQuery: Remove Div after 2 combined animations done?

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

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

this should to it

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM