Bootstrap 3:折叠手风琴不起作用

时间:2013-12-12 12:09:55

标签: jquery html css twitter-bootstrap

我创建了一个带有jquery和bootstrap的网页,但如果有导航栏我的手风琴不工作,如果我删除导航栏它可以正常工作。

更新:即使我删除了导航栏,也无法正常使用。

这就是我的意思:

http://jsfiddle.net/4UN4M/9/

<body>
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span>  <span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span>

            </button> <a class="navbar-brand" href="#">IBSApps</a>

        </div>
        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="#" id="dashlink"><span class="glyphicon glyphicon-home"></span>Dashboard</a>

                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li class="dropdown" id="profiling"><a href="#" class="dropdown-toggle" data-toggle="dropdown" id="proflink"><span
                class="glyphicon glyphicon-user"></span> Suryo Sapoetro <b class="caret"></b></a>

                    <ul class="dropdown-menu">
                        <li><a href="#"><span class="glyphicon glyphicon-user"></span>Profile <span class="small text-info">beta</span></a>

                        </li>
                        <li><a href="#"><span class="glyphicon glyphicon-cog"></span>Settings <span class="small text-info">beta</span></a>

                        </li>
                        <li class="divider"></li>
                        <li><a href="#"><span class="glyphicon glyphicon-off"></span>Logout</a>

                        </li>
                    </ul>
                </li>
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
</div>
<div class="container"></div>
<div class="container">
    <div id="container" class="row">
        <div class="col-lg-8">
            <div class="panel-group" id="accordion">
                <div class="panel panel-default">
                    <div class="panel-heading">
                         <h4 class="panel-title">
    <a data-toggle="collapse" data-parent="#accordion" href="#collapseone">
      Collapsible Group Item #1
    </a>
  </h4>

                    </div>
                    <div id="collapseOne" class="panel-collapse collapse in">
                        <div class="panel-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                         <h4 class="panel-title">
    <a data-toggle="collapse" data-parent="#accordion" href="#collapsetwo">
      Collapsible Group Item #2
    </a>
  </h4>

                    </div>
                    <div id="collapseTwo" class="panel-collapse collapse">
                        <div class="panel-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-heading">
                         <h4 class="panel-title">
    <a data-toggle="collapse" data-parent="#accordion" href="#collapsethree">
      Collapsible Group Item #3
    </a>
  </h4>

                    </div>
                    <div id="collapseThree" class="panel-collapse collapse">
                        <div class="panel-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
                    </div>
                </div>
            </div>
        </div>
        <div class="col-lg-4">
            <div class="row"></div>
        </div>
    </div>
</div>
<!-- /.container -->
</body>
抱歉我的英语。提前谢谢。

1 个答案:

答案 0 :(得分:1)

那是因为导航有一个position:fixed。添加到div #accordion{ margin-top:60px;}。这是定位的修复。你可以在控制台检查你有什么jQuery错误并发布吗?