D
D
Dmitriy Vasilyev2016-06-09 12:55:24
Angular
Dmitriy Vasilyev, 2016-06-09 12:55:24

How to set up the Accardion so that when it opens it closes the other one?

How to set up the Accardion so that when it opens it closes the other one?
Now they are all unfolding.
cb589e0741114fae89df3effd2193d1e.png

<div class="content-block-title">List View Accordion</div>
<div class="list-block accordion-list">
  <ul ng-repeat="movie in movies">
    <li class="accordion-item">
      <a href="#" class="item-content item-link">
        <div class="item-inner">
          <div class="item-title">{{movie.title}}</div>
        </div>
      </a>
      <div class="accordion-item-content">
        <div class="content-block">
          <p>{{movie.synopsis}}</p>
        </div>
      </div>
    </li>
  </ul>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2016-06-09
@streetflush

I suppose ng-repeat builds an accordion?
Then ng-class="'opened': openedId == $index"
And on click on the link hang ng-click="openedId=$index"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question