The accordion component is probably best known for FAQ pages or pages that require a lot of content to be broken down into manageable parts. An accordion is made up of a number of panel groups. Each panel group, in turn, has a heading and body elements.
An accordion effect is created by using the Bootstrap collapse plugin which allows you to toggle content in the pages using JavaScript.
To use the accordion component in our project, perform the following steps:
To allow the panel to collapse when the user clicks on its heading, we need to add a
data-toggle
attribute to an anchor<a>
element inside the panel heading element and set its value to collapse.We also need to specify the parent element of the panel by setting the
data-parent
attribute's value to the ID of the parent panel group. Next, set theanchor
element'shref
attribute to the ID of the<div>
element that contains the content.Finally, we also need to set the panel body element's class...