Bootstrap 3 Accordion必须始终打开顶层

dtcbnfnu  于 2022-12-07  发布在  Bootstrap
关注(0)|答案(1)|浏览(158)

我希望 accordion 的顶层面板始终保持打开状态。当用户单击任何其他面板时,它们必须像平常一样打开和关闭,而不会影响顶层面板。我的JavaScript技能很生疏,恐怕我已经忘记了很多东西。任何帮助都将不胜感激。谢谢。

<!-- Accordion -->
    <div class="panel-group  center-accordion-text" id="accordion" role="tablist" aria-multiselectable="true">
      <!-- One -->

      <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingOne1">
          <h4 class="panel-title">
            <a data-toggle="collapse"  href="#collapseOne1" aria-expanded="true" aria-controls="collapseOne1">
                <span clas="title-two"style="color:#A5DF00;">Claims Information</span>
            </a>
          </h4>
        </div>
        <div id="collapseOne1" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne1">
          <div class="panel-body">
            <p>The reason we have insurance is to give you peace of mind!<br>
           provides excellent claims service that is friendly , fair, and consistent.<br>
            <strong>In the event of a claim, contact your agent or broker. If after hours, contact the<br>
            24-hour Emergency Service at, which is represented by .<br>
            </strong></p>
          </div>
        </div>
      </div>


      <div class="panel panel-default">
          <div class="panel-heading" role="tab" id="headingOne" style="border-top: 0;">
          <h4 class="panel-title">
            <a data-toggle="collapse" data-toggle="collapse" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
              Property Loss - What to do
            </a>
          </h4>
        </div>
        <div id="collapseOne" class="panel-collapse collapse " role="tabpanel" aria-labelledby="headingOne">
          <div class="panel-body">
            <div class="col-md-6">
                  <p>
                      If you feel you have a possible loss which is covered by your policy the following steps should be taken as soon as possible:
                      <br>
                      <span class="green-text">1</span>.<span class="blue-text">Contact your Agent or Broker.</span>
                        An adjuster will be assigned at the earliest opportunity. A prompt and fair loss adjustment is made easier when the damages are seen before repairs are begun.
                        <br>
                        2.  Assess loss
                        If the loss is due to theft, burglary, robbery, vandalism or malicious acts, you should give immediate notice to the police or other authorities having jurisdiction and then follow step #1.

                  </p> 
              </div>
              <div class="col-md-6">
                  <p>
                      3.    Livestock loss
                    In the case of livestock alleged to have been killed by lightning, artificial electricity, drowning or accidental physical entrapment, follow step #1 and notify your veterinarian before moving the carcass. A veterinarian certificate stating the cause of death will be required in such cases. If the loss is insured by your policy the veterinarian fee will be paid by us.
                    Updating your insurance coverage on a regular basis will help to make any potential losses less of a financial burden. Contact your Agent or Broker if you have any concerns in this regard.

                  </p>
              </div>

          </div>
        </div>
      </div> <!-- end panel one -->
        <!-- Two -->
      <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingTwo">
          <h4 class="panel-title">
            <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
              Helping to prevent delays in providing a loss
            </a>
          </h4>
        </div>
        <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
          <div class="panel-body">
            Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
          </div>
        </div>
      </div>

        <!-- Three -->
      <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingThree">
          <h4 class="panel-title">
            <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
              Automobile loss - What to do
            </a>
          </h4>
        </div>
        <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
          <div class="panel-body">
            Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
          </div>
        </div>
      </div>
        <!-- Four -->
        <div class="panel panel-default">
        <div class="panel-heading" role="tab" id="headingFour">
          <h4 class="panel-title">
            <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
              Police Reporting Centre
            </a>
          </h4>
        </div>
        <div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
          <div class="panel-body">
            Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
          </div>
        </div>
      </div>
    </div><!-- end accordion -->
x33g5p2x

x33g5p2x1#

根据您的最终需要,您可以简单地将第一个面板移到面板组之外,这将禁用它。

<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
     <h4 class="panel-title">
       Collapsible Group Item #1
   </h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
    <div class="panel-body">Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.</div>
</div>

jsfiddle

相关问题