简体   繁体   English

jQuery:完成2个组合动画后删除Div?

[英]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. 我有一个执行2个动画的jQuery行,我要在按当前代码将其向上滑动后删除#flasher DIV。 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. 动画api页面包含一些示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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