Different Accordion Designs for your website

An Accordion is a menu which is vertically stacked list of headings that can be clicked to reveal or hide content associated with them. It is one of many ways you can expose content to users in a progressive manner. Accordion are used to show FAQs, sometime sidebar menu items. Using accordion is useful when you have short details that can hidden but are also important to be kept in the page for providing information.

How To Create an Accordion, What is an accordion on a website?, HTML Accordion, bootstrap accordion, jquery accordion, html accordion without css, expand collapse html code

In this article I am sharing how I created 5 different designs of Accordion. I will be sharing what are the things that are required to make Accordion and how you can implement and use them in your website or blog.

Additional things that are required are

Sr.NoRequirementLink
1. Font Awesome Download
2. JQuery Download

Accordion designs

Design 1 (Simple and Normal Accordion)

This design is simple and easy. Just add the heading and the summary.

View Code

Design 2 (Accordion with Animated Up-Down Symbol)

A replica design of the above but with addition of animated up-down symbol

View Code

Design 3 (Bootstrap Like Accordion)

This design is similar to the Bootstrap Accordion, but uses no bootstrap. Having plus (+) and minus (-) symbol on opening and closing of the summary.

View Code

Design 4 (Opaque Stylish Accordion)

Accordion design with some style, having opaque background(Transparent), giving an awesome feel.

View Code

Design 5 (Colorful Accordion)

This design is having colorful right borders. Colors can changed as per the choice. This colorful design is going to be really interactive and attract the user.

View Code

Here is the working example of all the designs:

See the Pen 5 different Accordion Designs by bishal-biswas (@bishal-biswas) on CodePen.

Customize Options

If you want to do any changes, you are free to do. Here is some quick customizable options explained:

Change width

If you want to change the width of the accordion, you simply manipulate in css. See the example:

.Accordion-normal { width: 70%; } /*For mobile Devices, Set width to 100%*/ @media (max-width:540px){ .Accordion-normal { width: 100%; } }

Enable Only Show one Summary at a time

If you want multiple summaries to be opened simultaneously then remove this code from the JS file.

/*For Closing other Option if only one is to be shown*/ $(this).siblings('.content').children('.answer').fadeOut(); $(this).siblings('.content').children('.Heading').children('.Show').removeClass('fa-minus'); $(this).siblings('.content').children('.Heading').children('.Show').addClass('fa-plus'); $(this).siblings('.content').children('.Heading').children('.Show').removeClass('rot180');

Animation CSS

For animation of Up-down symbol and Plus-Minus replace, the code which is used is:

<style> .Show { -webkit-transition: .4s; transition: .4s; } .rot180 { transform: rotate(180deg); } </style> <script> /*For Chevro Animation*/ $(this).children('.Heading').children('.Show').toggleClass('rot180'); /*For Bootstrap + - toggle*/ if ($(this).children('.Heading').children('.Show').hasClass('fa-plus')) { $(this).children('.Heading').children('.Show').removeClass('fa-plus'); $(this).children('.Heading').children('.Show').addClass('fa-minus'); } else { $(this).children('.Heading').children('.Show').removeClass('fa-minus'); $(this).children('.Heading').children('.Show').addClass('fa-plus'); } </script>

If you like this article, please do share this with your friends and colleagues, and if you require any suggestions, do let me know in the comments.

Comments