Jquery 页面加载时淡出/淡入Div

Jquery 页面加载时淡出/淡入Div,jquery,fadein,fadeout,Jquery,Fadein,Fadeout,当一个新页面加载到我的站点上时,我希望旧页面的主要内容(位于主体内的一个div中,以排除页脚和页眉)淡出,而新页面的主要内容淡入,所有这些都是通过使用jQuery实现的。我的代码基本上是: <html> <head> -random header info- (also where I figured the jQuery would go?) </head> <body> <div id="header">

当一个新页面加载到我的站点上时,我希望旧页面的主要内容(位于主体内的一个div中,以排除页脚和页眉)淡出,而新页面的主要内容淡入,所有这些都是通过使用jQuery实现的。我的代码基本上是:

<html>

 <head> -random header info- (also where I figured the jQuery would go?)
 </head>

  <body>

   <div id="header">
   </div>

   <div id="main"> - main content of site - 
   </div>

   <div id="footer"> 
   </div>

  </body>

</html> 

-随机标题信息-(也是我认为jQuery会去的地方?)
-网站的主要内容-

我只想淡出和淡入影响:
我如何才能做到这一点?

试试这个,确保包括jquery库

$(document).ready(function(){
    $("div#main").fadeOut();
});
若要淡入,请将
style=“display:none”
添加到您的div中,并将文档中的
fadeOut()
更改为
fadeIn()-
淡出:-

$('#main').fadeOut('slow');
法丹:-

$('#newcontent').fadeIn('slow');

你认为新内容来自哪里?