具有fadeIn效果的jQuery .load() [英] jQuery .load() with fadeIn effect

查看:83
本文介绍了具有fadeIn效果的jQuery .load()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用#primary中的jQuery通过AJAX加载URL的#content.它加载但不淡入.我究竟做错了什么?

I'm trying to load #content of a url via AJAX using jQuery within #primary. It loads but doesn't fadeIn. What am I doing wrong?

$('.menu a').live('click', function(event) {
        var link = $(this).attr('href');
        $('#content').fadeOut('slow', function(){
            $('#primary').load(link+' #content', function(){
                $('#content').fadeIn('slow');
            });
        });
        return false;
    });

非常感谢您的帮助.

推荐答案

实际上,我可以通过将效果应用到包装div上来做到这一点...

Actually I was able to do it by applying the effect to the wrapper div instead...

$('#primary').fadeOut('slow', function(){
    $('#primary').load(link+' #content', function(){
        $('#primary').fadeIn('slow');
    });
});

这篇关于具有fadeIn效果的jQuery .load()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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