Search code examples
jqueryloadfadein

jQuery .load() with fadeIn effect


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;
    });

Many thanks for your help.


Solution

  • 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');
        });
    });