我想在使用折叠时交换,在使用foreach循环时没有每个图标同时切换。fa fa-plusfa fa-minus
这是我的代码演示。
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<div class="container h-100">
<div class="row no-gutters border-0 rounded align-items-center mt-3">
<div class="col-sm-4">demo 1</div>
<div class="col-sm-4">demo 1</div>
<div class="col-sm-3">demo 1</div>
<div class="col-sm-1 ">
<a class="fa fa-plus" data-toggle="collapse" href="#collapse1" aria-expanded="true" aria-controls="collapse1"></a>
</div>
</div><!--row-->
<div class="collapse" id="collapse1">
<div class="row no-gutters border-0 rounded align-items-center mt-3">
<div class="col-sm-4">demo 1</div>
<div class="col-sm-4">demo 1</div>
<div class="col-sm-4">demo 1</div>
</div><!--collapse-->
</div>
<div class="row no-gutters border-0 rounded align-items-center mt-3">
<div class="col-sm-4">demo 2</div>
<div class="col-sm-4">demo 2</div>
<div class="col-sm-3">demo 2</div>
<div class="col-sm-1 ">
<a class="fa fa-plus" data-toggle="collapse" href="#collapse2" aria-expanded="true" aria-controls="collapse2"></a>
</div>
</div><!--row-->
https://codepen.io/benwhittaker25/pen/rNVWyby
在引导 4.4 中实现此目的的最佳方法是什么?
红颜莎娜
慕标琳琳