Вам совершенно не нужен угол, чтобы свернуть панели - вы можете сделать это с помощью прямой CSS.
Все, что вам нужно сделать, это переключить активный класс по нажатию кнопки, а затем использовать прямойкомбинатор братьев и сестер, нацеленный на следующий div и стиль его открытия или закрытия
.panel {
padding: 0 18px;
background-color: #f1f1f1;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.accordion.active + .panel {
max-height: 500px;
transition: max-height 0.2s ease-out;
}
var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].onclick = function() {
this.classList.toggle("active");
}
}
button.accordion {
background-color: #777;
color: white;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
button.accordion.active, button.accordion:hover {
background-color: #555;
}
button.accordion:after {
content: '\002B';
color: white;
font-weight: bold;
float: right;
margin-left: 5px;
}
button.accordion.active:after {
content: '';
background-image: url('download.jpg');
display: inline-block;
background-size: 30px 30px;
width:30px;
height:30px;
transform:rotate(180deg);
}
.panel {
padding: 0 18px;
background-color: #f1f1f1;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.accordion.active + .panel {
max-height: 500px;
transition: max-height 0.2s ease-out;
}
* {
box-sizing: border-box;
}
#myUL {
list-style-type: none;
padding: 0;
margin: 0;
}
a{
text-decoration: none;
color:white;
}
<h2>Collapsible</h2>
<p>Click the button to toggle the collapsible content.</p>
<div id="div2">
<button class="accordion"><a href="#">Addq</a></button>
<div class="panel">
<p>Some collapsible content. Click the button to toggle between showing and hiding the collapsible content. Lorem ipsum dolor sit amet,ome Some collapsible content. Click the button to toggle between showing and hiding the collapsible content.
<button class="accordion"><a href="#">Aollapsible</a></button>
<div class="panel">
<p>sdfsdfsdfsdt amet,ome Some collapsible content. Click the button to toggle between showing and hiding the collapsible content. </p>
</div>
<button class="accordion"><a href="#" style="">Dollapsible</a></button>
<div class="panel">
<p>qqqqqqqqqqqpsible content. consequat.</p>
</div>
<button class="accordion"><a href="#">Qollapsible</a></button>
<div class="panel">
<p>zzzzzzzzzllapsible content. commodo consequat.</p>
</div>
</div>