0 jquery timing fadeout fadein
看看这个:http://novarose.co.cc/web2/
淡化效果有点混乱,我不知道如何使其正常工作.
我希望代码按以下顺序运行:
我对该页面的jQuery代码:
$('#navigation a').click(function(){$ .get("page.php",{page:$(this).attr('id')},function(data){$('# content').fadeOut('slow').html(data).fadeIn('slow');});});
你的问题在这里:$('#content').fadeOut('slow').html(data).fadeIn('slow'); });
这fadeIn在fadeOut完成之前就开始了.你想这样做:
$('#content').fadeOut('slow', function(){
$(this).html(data).fadeIn('slow')
});
Run Code Online (Sandbox Code Playgroud)
第二个参数是完成后fadeOut要调用的函数.fadeOut