javascript - slideDown 不工作或像 .show 一样工作

标签 javascript jquery css slidedown

我正在尝试 slideDown() 一个隐藏的 div,但它只显示()它而没有 slideDown() 效果。当我打开按钮时,内容会在 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+'.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>

最佳答案

阅读jQuery's API关于 slideDown()。其中normal没有参数,duration应该是数值或者slow,或者fast

关于javascript - slideDown 不工作或像 .show 一样工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15360266/

相关文章:

javascript - 在 _.filter 中访问 this.var?

javascript - jQuery 脚本在 IE 中不起作用?

javascript - Ajax 增加购物车数量只工作一次

css - 是否有 CSS 父级选择器?

html - 仅适用于具有特定父项的 tr

html - 仅在某些情况下延迟过渡

javascript - 单击具有指定功能的按钮时,如何在输出框中的下拉菜单中显示选项的值?

javascript - IE 中的评估问题

javascript - 在新标签页中打开 iFrame 链接?

javascript - React inline-style 将绿色 HSL 变成白色 RGB