我想slideDown()一個隱藏的div但它只顯示()它沒有slideDown()效果。當我的時鐘按鈕內容2-3秒 後突然apears這裏是JSslideDown不工作或工作像.show
var hash = window.location.hash.substr(1);
var href = $('#nav li a').each(function(){
var href = $(this).attr('href');
if(hash==href.substr(0,href.length-5)){
var toLoad = hash+'.html #content';
$('#content').load(toLoad)
}
});
$('#nav li a').click(function(){
var toLoad = $(this).attr('href')+' #content_id1';
$('#content').fadeOut(1000,loadContent);
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
function loadContent() {
$('#content').load(toLoad,'',showNewContent())
}
function showNewContent() {
$('#content').slideDown('normal');
}
return false;
});
這裏是CSS
#content {width:934px;margin-top:238px;position:relative;height:500px;display:none;}
#content #content_id1{width:934px; background-color:white; height:500px; position:relative;top:4px;margin-top:238px;margin-bottom:50px;padding:20px;}
,這裏是HTML
<ul id="nav">
<li>
<a href="products/rania.php"><img src="img/products/1.jpg"/></a>
</li>
<li class="under">
<a href="products/lutron.php"><img src="img/products/2.jpg"/></a>
</li>
</ul>
<div id="content"> </div>
[縮小的測試用例](http://css-tricks.com/reduced-test-cases/)會有幫助。 – Whymarrh 2013-03-12 11:46:40
在$('#content')中從'showNewContent()'中移除缺省值。load(toLoad,'',showNewContent())' - 使用它們調用'showNewContent()'並指定返回值'undefined')作爲'.load()'''完成'處理程序' – Andreas 2013-03-12 11:48:29
謝謝Andreas。這是有幫助的 – BahaS 2013-03-12 11:52:22