简体   繁体   English

引导式手风琴无法在其中使用表格

[英]bootstrap accordion not working with table inside it

I have three accordions. 我有三个手风琴。 In one of my accordion I have a table. 在我的一部手风琴中,我有一张桌子。 As the behaviour of bootstrap accordion, only one will open at a time. 作为自举式手风琴的行为,一次只能打开一个。 From the time I put it in the page it was not working accordingly. 从我将其放入页面开始,它就没有相应地工作。 I spend my whole day finding solution for it and at last I thought of putting question here and while I was writing my question title, I found a suggestion saying accordion problem with datatable. 我花了一整天的时间为它寻找解决方案,最后我想到在这里提出问题,而当我写问题标题时,我发现了一条建议,说明数据表中的手风琴问题。 Instantly I commented my table and now accordian work. 我立刻评论了我的桌子和现在的手风琴作品。 Does anybody know anything about this as I need to have that table inside my accordion. 有人对此有所了解吗,因为我需要在手风琴内放一张桌子。

here is my html: 这是我的HTML:

<div class="panel-group" id="accordian1">
                        <div class="panel panel-danger">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a role="button" data-toggle="collapse" data-parent="#accordian1" href="#collapseOne">
                                        Cost
                                    </a>
                                </h4>
                            </div>
                            <div id="collapseOne" class="panel-collapse in">
                                <div class="panel-body" style="text-align:justify;">
                                    <p>some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text</p>

                                </div>
                            </div>
                        </div>
                        <div class="panel panel-danger">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordian1" href="#collapseTwo">
                                        some text
                                    </a>
                                </h4>
                            </div>
                            <div id="collapseTwo" class="panel-collapse collapse">
                                <div class="panel-body" style="text-align:justify;">

                                    <p>some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text</p>

                                    <div class="table-responsive">
                                        <table class="table table-bordered table-hover table-striped">
                                            <thead>
                                                <tr>
                                                    <th>some text</th>
                                                    <th style="width: 171px;">some text</th>
                                                    <th>some text</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td>some text</td>
                                                    <td>some textsome text</td>
                                                    <td>
                                                        <p>some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text</p>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>some text</td>
                                                    <td>some textsome text</td>
                                                    <td>some textsome textsome text</td>
                                                </tr>
                                                <tr>
                                                    <td>some text</td>
                                                    <td>some text</td>
                                                    <td>
                                                        <p>some textsome textsome textsome textsome textsome textsome textsome text</p>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="panel panel-danger">
                            <div class="panel-heading">
                                <h4 class="panel-title">
                                    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordian1" href="#collapseThree">
                                        Job Prospect
                                    </a>
                                </h4>
                            </div>
                            <div id="collapseThree" class="panel-collapse collapse">
                                <div class="panel-body" style="text-align:justify;">
                                    <p>some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text</p>
                                    <p>some textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome textsome text.</p>

                                    <b>some text bbbbb</b><br />
                                    <p>some textsome textsome textsome textsome textsome text.</p>
                                </div>
                            </div>
                        </div>
                    </div>

Your code is perfectly working for me. 您的代码非常适合我。 You can try 你可以试试

  1. Test by Creating separate file for this having all bootstrap libraries links. 为此创建具有所有引导程序库链接的单独文件进行测试。
  2. Check if there is any Javascript error in your script by installing Firebug in your Mozilla Firefox. 通过在Mozilla Firefox中安装Firebug,检查脚本中是否存在Javascript错误。

在此处输入图片说明


Your table works absolutely fine in the accordion! 您的桌子在手风琴上绝对好用! Make sure your jquery and bootstap scripts are loaded correctly 确保正确加载了jquery和bootstrap脚本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM