Javascript 向下滑动不工作或工作方式类似。显示
我试图滑动一个隐藏的div,但它只显示它,没有滑动效果。当我按时钟时,按钮内容在2-3秒后突然出现 这是jsJavascript 向下滑动不工作或工作方式类似。显示,javascript,jquery,css,slidedown,Javascript,Jquery,Css,Slidedown,我试图滑动一个隐藏的div,但它只显示它,没有滑动效果。当我按时钟时,按钮内容在2-3秒后突然出现 这是js 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+'.
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>
阅读向下滑动()
。如果没有参数作为normal
,则持续时间应为数值或slow
,或fast
A将有帮助。从$(“#content”)中的showNewContent()
中删除偏执。加载(toLoad)”,showNewContent()
-用它们调用showNewContent()
并将返回值(undefined
)指定为.load()的complete
处理程序。如果在使用的值中找不到值(normal
),则这会很有帮助,该值为400
-介于slow:600
和fast:200