jquery负载淡入淡出的内容
我正在使用jQuery来淡出特定的div,然后我想淡化新的内容到同一个div。 淡出效果很好,但没有淡入淡出......而是立即“突然出现”,没有任何淡化效果。
这是我的:
$('#account-info-form').fadeOut('slow', function(){
    $('#tab_account_info').load('/account/ #account-info-form', function() {
        $('#account-info-form').fadeIn('slow');
        // show success toast
        toastr.info('Your profile has been updated.', 'Updated!');
        // reinitialize the form validation stuff
        AccountProfile.init();
    });
});
  您正在用新的可见元素替换隐藏的元素。  您应该淡化包含的元素。  根据你的代码,它看起来就是#tab_account_info 。  如果由于某种原因你不能隐藏#tab_account_info那么你应该添加一个包装器元素并淡入/加载它。 
  发生这种情况的原因是,当您使用fadeOut ,会添加隐藏该元素的内联样式。  当该元素被替换时(在这种情况下通过load ),嵌入式样式会丢失。 
  另一种方法是在调用fadeIn之前简单地隐藏新元素,如下所示: 
$('#account-info-form').hide().fadeIn('slow');
