淡入/淡入页面加载 [英] Fade Out/In Div on Page Load

查看:155
本文介绍了淡入/淡入页面加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当新页面加载到我的网站上时,我希望旧页面的主要内容(位于主体内部的div中,以排除页脚和页眉)逐渐消失,而新页面的主要内容淡入淡出,全部使用jQuery.我的代码基本上是:

When a new page loads on my site, I want the main content (located within a div inside the body,as to exclude the footer and header) of the old page to fade out, and the main content of the new page to fade in, all by using jQuery. My code is basically:

<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> 

我只希望淡入和淡出能够影响:<div id="main">我该怎么做?

I only want the fade out and in to affect: <div id="main"> how can I do this?

推荐答案

在您的文档中.就绪: 淡出:-

In your document.ready:- Fadeout:-

$('#main').fadeOut('slow');

淡入:-

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

这篇关于淡入/淡入页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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