2014-01-13 157 views
0

我想简单地显示加载后的内容而不是淡入淡出这怎么可能?FadeOut内容加载和显示内容

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

也许我使用.show()?

感谢您的帮助

+0

你不试试吗?即使用'.show()' – techfoobar

+0

它不起作用:/当然是.. – andre34

+0

@KevinBowersox - 是的,我认为是。但不仅仅是'show()',你可能需要类似'.css('opacity',1).show()' – techfoobar

回答

1

就淡入0,它会立即发生

$(this).html(data).fadeIn(0); 

你也可能要做到这一点

$(this).html(data).delay(2000).fadeIn(0); 

加2秒的延迟或者不过多你,然后立即显示

+0

感谢您的支持! :) – andre34

2
success: function(data) { 
    $('#allcontent').html(data).show(); 
}