Bootstrap 4 collapse (FAQ) demo.

Bootstrap 4 collapse (FAQ) demo.

This article we are creating Bootstrap 4 collapse (FAQ) demo. First of all we can use bootstrap 4 collapse question & answers section. We have been using HTML, CSS & JAVASCRIPT. How we have inserted HTML, CSS, JAVASCRIPT into our file. This is a very useful module for all web player. Just copy and paste this simple code & your FAQ section is ready.

This module you can also change according your design, because this is a custom bootstrap 4 code. we can also add even more content & also change the up & down arrow.

By using this plugin the design will look like this.

First of all you put Html in your file.

<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>

Then put Css in your file.

  


And css link in your Html head section

https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css

https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css

And Some css put in your css file.

*{
  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;
}

Then put Js in your file.

  


And Some js link in your page.

https://code.jquery.com/jquery-3.3.1.slim.min.js

https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js

https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js

And Some js put in your page.

$(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");
    });
});

We have given the best suitable and easiest way for Bootstrap 4 collapse (FAQ) demo.

Thanks for reading this article. We have Html & Html5, jquery, js, css question & answer & Angular6 also. For more designs solutions like this, you simply visit our site’s post and pages. Collection of amazing designing, development tricks and tips. Hope you like Bootstrap 4 collapse (FAQ) demo for any query & suggestion please comment.

#bootstrap4 #bootstrap4collapse #FAQ

Leave a Reply

Your email address will not be published. Required fields are marked *