Fade out a div with content A, and Fade In the same div with content B

纵饮孤独 提交于 2019-12-01 01:10:30

Try this:

$(function() {
    $('.ajaxloader').click(function(event) {
        var target = $(this).attr('href');
        window.location.hash = target;
        $.ajax({
            url: target,
            success: function(data) {
                $('#conteudoInscricao')
                    .fadeOut('slow', function() {
                        $(this).html(data).fadeIn('slow');
                    });
            }
        });
        return false;
    });
});

So the effect will happen only after you have retrieved your data, avoiding any time gap to wait the data response.

At the moment it wont, because the fadeIn wont start until the fadeOut has finished!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!