单击按钮折叠/展开手风琴

时间:2019-04-04 17:36:40

标签: javascript button accordion collapse expand

我之前曾问过这个问题,但是我不清楚我的问题 我想通过单击按钮来折叠手风琴的一部分,该按钮将禁用当前部分并展开手风琴的下一部分 https://jsfiddle.net/2L1x9v07/

Collapse current accordion section disabling it and expand next 

小提琴中的手风琴的前两个部分中有一个继续按钮 单击继续后,当前部分折叠,下一部分展开 我该如何实现?

1 个答案:

答案 0 :(得分:0)

您可以使用<a>标签上使用的相同方法

<div ng-init="accordion=1">
    <h3 class="accordion" ng-class="{active:accordion==1}">
        <a href ng-click="accordion = 1">Section 1</a>
    </h3>
    <p class="accordion-content" ng-show="accordion==1">Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using
  <br/>
 <button type="submit" style="max-width:200px" ng-click="accordion = 2" class="btn btn-primary btn-block pull-right">Continue</button></p>

    <h3 class="accordion" ng-class="{active:accordion==2}">
        <a href ng-click="accordion = 2">Section 2</a>
    </h3>
    <p class="accordion-content" ng-show="accordion==2">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using
  <br/>
 <button type="submit" style="max-width:200px" ng-click="accordion = 3" class="btn btn-primary btn-block pull-right">Continue</button>

  </p>

    <h3 class="accordion" ng-class="{active:accordion==3}">
        <a href ng-click="accordion = 3">Section 3</a>
    </h3>
    <p class="accordion-content" ng-show="accordion==3">There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form</p>
</div>