php 默认情况下折叠此面板

e0uiprwp  于 2022-11-21  发布在  PHP
关注(0)|答案(1)|浏览(193)

需要此面板默认折叠,它目前是打开时,页面加载。我已经尝试谷歌的东西,似乎没有工作。

<div class="col-md-12">
    <div class="panel panel-default">
        <div class="panel-title">

               Subcontractors
            <ul class="panel-tools">
                <li><a class="icon minimise-tool no-print"><i class="fa fa-minus"></i></a></li>
            </ul>
        </div>
        <div class="panel-body table-responsive" class="panel-collapse collapse">

            <table id="subcontractor_table" class="table table-striped">
                <thead>
                    <tr>
                        <td>First Name</td>
                        <td>Last Name</td>
                        <td width="200px">Hours Quoted</td>
                        <td width="200px">Rate</td>
                        <td width="200px">Amount Quoted</td>
                        <td width="100px">Actions</td>
                    </tr>
                </thead>
                <tbody id="subcontractor_table_body"></tbody>
            </table>
        </div>
    </div>
</div>
rsl1atfo

rsl1atfo1#

您需要将data-toggle="collapse"data-target="#[YOURDIV]"添加到链接中,以便它知道要折叠的内容。

<div class="col-md-12">
    <div class="panel panel-default">
        <div class="panel-title">
            Subcontractors
            <ul class="panel-tools">
                <li><a class="icon minimise-tool no-print" data-toggle="collapse" data-target="#collapsible"><i class="fa fa-minus"></i></a></li>
            </ul>
        </div>
        <div id="collapsible" class="panel-body table-responsive panel-collapse collapse">

            <table id="subcontractor_table" class="table table-striped">
                <thead>
                    <tr>
                        <td>First Name</td>
                        <td>Last Name</td>
                        <td width="200px">Hours Quoted</td>
                        <td width="200px">Rate</td>
                        <td width="200px">Amount Quoted</td>
                        <td width="100px">Actions</td>
                    </tr>
                </thead>

                <tbody id="subcontractor_table_body"></tbody>
            </table>

        </div>
    </div>
</div>
<!-- End Subcontractors Panel -->

这里,我将id="collapsible"添加到div中,并在data-target="#collapsible"中引用它
编辑:因为您使用的是链接,所以您也可以将链接的href设置为#collapsible,并忽略data-target

<a class="icon minimise-tool no-print" data-toggle="collapse" href="#collapsible"><i class="fa fa-minus"></i></a>

相关问题