Using Bootstrap 4, I am trying to create a dropdown with caret (Ex: pointing right). On clicking dropdown the caret pointing direction should be changed (Ex: down).
I have got a way to do that
/*Please refer the above link for full code details*/
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Collapsible Group Item #1
</a>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
This content is hidden
</div>
</div>
.css
.panel-heading .accordion-toggle:after {
font-family: 'Glyphicons Halflings';
content: "e114";
float: right;
color: grey;
}
.panel-heading .accordion-toggle.collapsed:after {
content: "e080";
}
But the catch is, initially all the carets pointing down which should be right
There are other approaches. But I don't want to use JQuery, as my application is angular 4. Would like to avoid JQuery/JS as much as possible.
This is not a duplicate question.
Many thanks in advance...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…