jquery ajax成功淡化效果 [英] jquery ajax success fade effects

查看:70
本文介绍了jquery ajax成功淡化效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦得到ajax响应,我想做一些像 fadeIn 这样的效果。
我试过这个,

I would like to do some effects like fadeIn to page once I get the ajax response. I tried this,

$.ajax({
        type: "post",
        url: actionLink,
        cache: false,
        data: ....someData....,
        success: function(data) {
           $(".response").fadeOut(100);
           $(".response").html(data);
           $(".response").fadeIn(500);
        }
    });

这是有效的,但数据首先显示,闪存500毫秒,数据具有淡入淡出效果,但我我需要直接使用淡入淡出效果来获取加载的数据。

This is working but data is displayed first and with a flash of 500ms getting data with fade effect but I need to get the loaded data directly with fade effect.

我甚至试过淡出带有内容A的div,淡入与内容B相同的div ,但我仍然遇到同样的问题。

I even tried with Fade out a div with content A, and Fade In the same div with content B, but I still get the same issue.

我也尝试过:

$(".response").fadeOut(100).hide();
$(".response").show().html(data).fadeIn(500);

仍然相同。我该如何解决这个问题?

Still the same. How do I fix this?

推荐答案

这件事有效.........

This thing worked.........

jQuery(".response").fadeOut( 100 , function() {
    jQuery(this).html( data);
}).fadeIn( 1000 );

这篇关于jquery ajax成功淡化效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆