bootstrap accordion bug:折叠切换回可见模式

时间:2014-09-24 14:50:54

标签: jquery css twitter-bootstrap

您可以测试这个非常简单的崩溃引导程序:

http://www.getshoutbox.com/test.php

如果您尝试折叠面板,它会再次显示:这是最简单的折叠样本:

<!DOCTYPE HTML>
<html>
<head>
<title>GAQ getSHoutBox</title>

<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>

<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
</head>
<body>


<div class="panel-group" id="accordion">
    <div class="panel panel-info">
        <div class="panel-heading">
            <div class="panel-title">
                <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#first">First</a>
            </div>
        </div><!--Here heading has to close and collapse has to start-->
        <div class="panel-collapse collapse" id="first">
            <div class="panel-body">
                <img src="images/lebowski-1.jpg" alt="1" />
            </div>
        </div>
    </div>
    <div class="panel panel-info">
        <div class="panel-heading">
            <div class="panel-title">
                <a class="collapsed" href="#secound" data-toggle="collapse" data-parent="#accordion">
                    Secound</a>
            </div>
        </div>
        <div class="panel-collapse collapse" id="secound">
            <div class="panel-body">
                <img src="images/lebowski-2.jpg" alt="2" />
            </div>
        </div>
    </div>
    <div class="panel panel-info">
        <div class="panel-heading">
            <div class="panel-title">
                <a class="collapsed" href="#third" data-toggle="collapse" data-parent="#accordion">Third</a>
            </div>
        </div>
        <div class="panel-collapse collapse" id="third">
            <div class="panel-body">
                <img src="images/lebowski-3.jpg" alt="3" />
            </div>
        </div>
    </div>
</div> 
</body>
</html>

有什么问题???

2 个答案:

答案 0 :(得分:0)

试试这个

<!DOCTYPE HTML>
<html>
<head>
<title>GAQ getSHoutBox</title>

<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-theme.css" rel="stylesheet" type="text/css">
<link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>

</head>
<body>

<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 Accordion 1
                            </a>
                        </h4>
                    </div>
                    <div id="collapseOne" class="panel-collapse collapse in">
                        <div class="panel-body">
                             <img src="images/lebowski-1.jpg" alt="1" />
                        </div>
                    </div>
                </div>


                <div class="panel panel-success">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#collapseFour">
                                Collapsible Accordion 2
                            </a>
                        </h4>
                    </div>
                    <div id="collapseFour" class="panel-collapse collapse">
                        <div class="panel-body">
                             <img src="images/lebowski-2.jpg" alt="2" />
                        </div>
                    </div>
                </div>


                <div class="panel panel-warning">
                    <div class="panel-heading">
                        <h4 class="panel-title">
                            <a data-toggle="collapse" data-parent="#accordion" href="#collapseFour">
                                Collapsible Accordion 3
                            </a>
                        </h4>
                    </div>
                    <div id="collapseFour" class="panel-collapse collapse">
                        <div class="panel-body">
                             <img src="images/lebowski-3.jpg" alt="3" />
                        </div>
                    </div>
                </div>

        </div>  
</body>
</html>

答案 1 :(得分:0)

您的手风琴无效,因为您使用的是v1.7.1 jquery

/*! jQuery v1.7.1 jquery.com | jquery.org/license */

和bootstrap正在使用v1.11.1 jquery

/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */