jQuery FadeOut很多div

我试图一次淡出多个div并在完成后淡入一个div.这是代码
if($(this).attr("id")==="benefits-button"){

    $("#solar-about,#home-page,#process-page,#financing-page,#vendors-page,#consump-info-page,#smart-page,#wind-page,#about-page").fadeOut(750,function() {
         $("#benefits-page").fadeIn(750);
    });
    }

当选择器中有多个div时,fadeOut和fadeIn同时发生.

问题:如何在fadeOut之后获得fadeIn?

谢谢

解决方法

$("#benefits-page").fadeIn(750);

正在立即工作,因为当第一个元素(在你的例子中是#-solar-about)fadeOut动画完成时它开始工作.

如果你想等到所有动画都完成,你可以使用.promise(),如下所示:

$("#solar-about,#about-page").fadeOut(750).promise().done(function() {
     $("#benefits-page").fadeIn(750);
});

DEMO

相关文章

页面搜索关键词突出 // 页面搜索关键词突出 $(function () {...
jQuery实时显示日期、时间 html: <span id=&quot...
jQuery 添加水印 <script src="../../../.....
中文:Sys.WebForms.PageRequestManagerParserErrorExceptio...
1. 用Response.Write方法 代码如下: Response.Write(&q...
Jquery实现按钮点击遮罩加载,处理完后恢复 思路: 1.点击按...