Bootstrap 3以编程方式折叠面板

时间:2014-09-01 10:43:19

标签: twitter-bootstrap twitter-bootstrap-3 collapse

我有一个问题。 有没有办法崩溃并以编程方式切换回自举面板。

<div class="panel panel-default panel-primary">
    <div class="panel-heading">
                ...
        <div class="pull-right">
            <div class="btn-group">
                <button type="button" class="btn btn-info btn-xs" data-toggle="collapse" data-target="#to">
                    <i class="fa fa-chevron-down fa-fw"></i>
                </button>
            </div>
        </div>
    </div>
    <div id="to" class="panel-body collapse">....</div>
</div>

我需要将其折叠或使用某个处理程序进行扩展。

1 个答案:

答案 0 :(得分:2)

试试这个:

<div class="panel panel-default panel-primary">
    <div class="panel-heading">
                ...
        <div class="pull-right">
            <div class="btn-group">

            </div>
        </div>
    </div>
    <div id="to" class="panel-body collapse">....</div>
</div>


        <button type="button" class="btn btn-info btn-xs" data-toggle="collapse" data-target="#to">
                    <i class="fa fa-chevron-down fa-fw"></i> Click me
                </button>

DEMO