twitter-bootstrap – Bootstrap手风琴面板/折叠

前端之家收集整理的这篇文章主要介绍了twitter-bootstrap – Bootstrap手风琴面板/折叠前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的自举舞会表现出气质!我已经创建了三列显示在一个列网格中的面板,但第二和第三个折叠菜单关闭错误菜单(例如点击/打开菜单2,然后点击/打开菜单3将关闭菜单2,然后打开菜单3).

任何想法为什么?

代码在这里:

<div class="row">
            <div class="col-sm-6 col-md-4">
                <div class="panel-group">
                    <div class="panel panel-default">
                        <a class="panel-default" data-toggle="collapse" data-parent="#accordion" href="#collap@R_403_401@ne">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                            My Story
                            </h4>
                        </div>
                        </a>
                        <div id="collap@R_403_401@ne" class="panel-collapse collapse">
                            <div class="panel-body">
                            Content
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6 col-md-4">
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default">
                        <a class="panel-default" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                            My Skills
                            </h4>
                        </div>
                        </a>                            
                        <div id="collapseTwo" class="panel-collapse collapse in">
                            <div class="panel-body">
                            Content
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-6 col-md-4">
                <div class="panel-group" id="accordion">
                    <div class="panel panel-default">
                        <a class="panel-default" data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                            My Ambition
                            </h4>
                        </div>
                        </a>                            
                        <div id="collapseThree" class="panel-collapse collapse">
                            <div class="panel-body">
                            content
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

解决方法

您需要编号手风琴,即手风琴1手风琴2手风琴3
<div class="row">
    <div class="col-sm-6 col-md-4">
        <div class="panel-group">
            <div class="panel panel-default">
                <a class="panel-default" data-toggle="collapse" data-parent="#accordion1" href="#collap@R_403_401@ne">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    My Story
                    </h4>
                </div>
                </a>
                <div id="collap@R_403_401@ne" class="panel-collapse collapse">
                    <div class="panel-body">
                    Content
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6 col-md-4">
        <div class="panel-group" id="accordion">
            <div class="panel panel-default">
                <a class="panel-default" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    My Skills
                    </h4>
                </div>
                </a>                            
                <div id="collapseTwo" class="panel-collapse collapse in">
                    <div class="panel-body">
                    Content
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6 col-md-4">
        <div class="panel-group" id="accordion">
            <div class="panel panel-default">
                <a class="panel-default" data-toggle="collapse" data-parent="#accordion3" href="#collapseThree">
                <div class="panel-heading">
                    <h4 class="panel-title">
                    My Ambition
                    </h4>
                </div>
                </a>                            
                <div id="collapseThree" class="panel-collapse collapse">
                    <div class="panel-body">
                    content
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
原文链接:https://www.f2er.com/bootstrap/234069.html

猜你在找的Bootstrap相关文章