<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<section class="wrp-faq">
<h2> Bootstrap 4 Faq demo</h2>
<div class="container">
<div class="accordion" id="accordionExample">
<div class="card">
<div class="card-header" id="headingOne">
<h2>
<button type="button" class="collapsed" data-toggle="collapse" data-target="#collapseOne"> Lorem ipsum dolor sit amet, consectetur adipisicing elit. <i class="fa fa-angle-up"></i></button>
</h2>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingTwo">
<h2>
<button type="button" data-toggle="collapse" data-target="#collapseTwo"> Duis aute irure dolor in reprehenderit in voluptate. <i class="fa fa-angle-down"></i></button>
</h2>
</div>
<div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="headingThree">
<h2>
<button type="button" data-toggle="collapse" data-target="#collapseThree"> Excepteur sint occaecat cupidatat non proident. <i class="fa fa-angle-down"></i></button>
</h2>
</div>
<div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
<div class="card-body">
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
</div>
</div>
</div>
</div>
</section>
<h4 class="text-center mt-2">Designed by <a href="https://www.papawebdesigner.com/2019/07/23/bootstrap-4-collapse-faq-demo/" target="_blank">papawebdesigner</a></h4>
*{
margin: 0px;
padding: 0px;
outline: none;
}
.wrp-faq button:focus{
outline: none;
}
.wrp-faq button {
border: none;
background: transparent;
width: 100%;
outline: none;
text-align: left;
font-weight: 600;
font-size: 21px;
position: relative;
padding: 17px 20px 15px 20px;
}
.wrp-faq .card-header {
padding: 0;
}
.wrp-faq .card i.fa {
float: right;
transition: all 0.5s;
position: absolute;
right: 20px;
font-size: 32px;
}
.wrp-faq > h2 {
text-align: center;
font-size: 50px;
padding: 48px 10px;
}
$(document).ready(function(){
// Add minus icon for collapse element which is open by default
$(".collapse.show").each(function(){
$(this).prev(".card-header").find(".fa").addClass("fa-angle-up").removeClass("fa-angle-down");
});
// Toggle plus minus icon on show hide of collapse element
$(".collapse").on('show.bs.collapse', function(){
$(this).prev(".card-header").find(".fa").removeClass("fa-angle-down").addClass("fa-angle-up");
}).on('hide.bs.collapse', function(){
$(this).prev(".card-header").find(".fa").removeClass("fa-angle-up").addClass("fa-angle-down");
});
});