The accordion/collapse component

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:

  1. 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.
  2. We also need to specify the parent element of the panel by setting ...

Get Bootstrap for ASP.NET MVC - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.