简体   繁体   English

如何折叠和扩展手风琴的每个特定部分

[英]How can I collapse and expand each specific part of the accordion

AngularJs Accordion Flow AngularJs手风琴流程

I am having a difficult time grasping the concept of manipulating accordions I have a step by step module implemented as an accordion. 我很难掌握操纵手风琴的概念我有一个逐步实现手风琴的模块。 After completion of part 1 of the module, I would like to collapse part 1 and expand part 2. Once part 2 of the module is complete, I want to collapse part 2 and expand part 3 The accordion I am using is as follow: https://jsfiddle.net/b0yc246z/ 在完成模块的第1部分之后,我想折叠第1部分并展开第2部分。一旦模块的第2部分完成,我想要折叠第2部分并展开第3部分我正在使用的手风琴如下: https ://jsfiddle.net/b0yc246z/

<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</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</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>

My initial approach was to give each part of the module and id and manipulate each part through JS How can I collapse and expand each specific part of the accordion? 我最初的方法是给模块的每个部分和id并通过JS操纵每个部分如何折叠和扩展手风琴的每个特定部分?

Here is a fiddle: https://jsfiddle.net/MSclavi/e9vhs0jL/1/ 这是一个小提琴: https//jsfiddle.net/MSclavi/e9vhs0jL/1/

You can use the same idea but with a button inside the accordion. 您可以使用相同的想法,但手风琴内有一个按钮。 If you have to do something extra (data verification, etc), you can call a function from the buttons ng-click . 如果你必须做额外的事情(数据验证等),你可以通过按钮ng-click调用一个函数。

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

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