Fout Out / In Div页面加载
当我的网站上加载新页面时,我希望旧页面的主要内容(位于正文中的div内,以排除页脚和页眉)淡出,并且新页面的主要内容将淡入,都是通过使用jQuery。 我的代码基本上是:
-random header info- (also where I figured the jQuery would go?) - main content of site -
我只希望淡出和影响:
我该怎么做?
试试这个,确保包括jquery库。
$(document).ready(function(){ $("div#main").fadeOut(); });
要淡入,请在您的div中添加style="display:none"
,并将fadeOut()
更改为fadeIn()
。
在你的document.ready中: – 淡出: –
$('#main').fadeOut('slow');
淡入:-
$('#newcontent').fadeIn('slow');