- 33 jQuery Accordions
- Related Articles
- Table of Contents:
- jQuery Accordion Examples
- Author
- Links
- Made with
- About a code
- jQuery Accordion with Arrow (No Bootstrap)
- Author
- Links
- Made with
- About a code
- Dropdown/Accordion
- Author
- Links
- Made with
- About a code
- Custom Accordion for Right
- Author
- Links
- Made with
- About a code
- jQuery Accordion
- Author
- Links
- Made with
- About a code
- Accordion Scroll Top
- Author
- Links
- Made with
- About a code
- Accordion and Google Schema
- Author
- Links
- Made with
- About a code
- jQuery Accordion Styles
- Author
- Links
- Made with
- About a code
- Simple Sliding Accordion
- Author
- Links
- Made with
- About a code
- Accordion Slider
- Author
- Links
- Made with
- About a code
- Image Accordions
- Author
- Links
- Made with
- About a code
- Accordion With Close Button
- Author
- Links
- Made with
- About a code
- Simple Responsive jQuery Accordion
- Author
- Links
- Made with
- About a code
- Responsive jQuery Accordion
- Author
- Links
- Made with
- About a code
- Accordion with dt & dd tags.
- Author
- Links
- Made with
- About a code
- CSS-JS Multi-Level Accordion
- Author
- Links
- Made with
- About a code
- CSS Animation for jQuery Accordion
- Author
- Links
- Made with
- About a code
- Accordion
- Author
- Links
- Made with
- About a code
- jQuery Accordion Navigation Menu
- Author
- Links
- Made with
- About a code
- Accordion Menu
- Author
- Links
- Made with
- About a code
- 4 Lines jQuery Accordion
- Author
- Links
- Made with
- About a code
- 3D Accordion
- Author
- Links
- Made with
- About a code
- Accordion Profile
- Author
- Links
- Made with
- About a code
- jQuery Accordion
- Author
- Links
- Made with
- About a code
- Sassy Accordion
- Author
- Links
- Made with
- About a code
- Accordion Multi Menu
- Author
- Links
- Made with
- About a code
- jQuery (UI-Less) Accordion
- Author
- Links
- Made with
- About a code
- Simple Sass/jQuery Accordion
- jQuery Accordion Plugins
- Author
- Links
- Made with
- About a code
- Accordion with jQuery
- Author
- Links
- Made with
- About a code
- Arai Accordion
- Author
- Links
- Made with
- About a code
- Ziehharmonika
- Author
- Links
- Made with
- About a code
- Simple Jquery Multi Accordion
- Author
- Links
- Made with
- About a code
- jQuery Accessible Accordion System
- Author
- Links
- Made with
- About a code
- jQuery Accordion
- Accordion
- Examples
- Interactions
- Widgets
- Effects
- Utilities
- Books
- How to make Accordion with HTML, CSS and jQuery
- Contents
- 1. HTML
- 2. CSS
- 3. jQuery
- 4. Demo
- 5. Conclusion
33 jQuery Accordions
Collection of free vertical and horizontal jQuery UI accordion code examples and plugins from Codepen and GitHub. Update of September 2021 collection. 2 new items.
Related Articles
Table of Contents:
jQuery Accordion Examples
Author
Links
Made with
About a code
jQuery Accordion with Arrow (No Bootstrap)
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Dropdown/Accordion
Animated accordion in jQuery.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Custom Accordion for Right
jQuery custom accordion with Material Design Iconic font.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Accordion Scroll Top
Accordion with scroll animation in jQuery.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Accordion and Google Schema
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery Accordion Styles
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Simple Sliding Accordion
Simple vertical sliding accordion with little jQuery.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Accordion Slider
Simple horizontal jQuery accordion slider.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Image Accordions
Image accordions demo with swiper.js
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Dependencies: swiper.css, swiper.js
Author
Links
Made with
About a code
Accordion With Close Button
This is a simple example of how you can create an accordion from a regular HTML tag and a pair of jQuery lines. We often resort to using complex patterns and writing long code when creating sliders and accordions, completely forgetting that there are very simple ways to solve these problems. Here you do not need to be well versed in the code to stylize it and add animation.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Simple Responsive jQuery Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Responsive jQuery Accordion
A responsive jQuery accordion that allows the user to navigate from form to form by clicking on tabs, using the arrow keys and clicking on the provided arrow buttons. Created using jQuery and Bootstrap.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Dependencies: font-awesome.css, bootstrap.css
Author
Links
Made with
About a code
Accordion with dt & dd tags.
jQuery accordion using definition lists.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS-JS Multi-Level Accordion
A multi-level CSS and JS (jQuery) accordion. This has the feature to pre-open a list group on initial page load, by simply adding the is-open class to the list item that has has-children class. HTML and CSS are written using the BEM syntax.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
CSS Animation for jQuery Accordion
Accordion for meteo application in jQuery with CSS animation.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery Accordion Navigation Menu
A reusable jQuery accordion navigation menu, works with any amount of categories and subcategories.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Accordion Menu
Hamburger slide accordion menu with jQuery.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
4 Lines jQuery Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
3D Accordion
Simple jQuery accordion with 3D folding paper effect.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Accordion Profile
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Sassy Accordion
Simple CSS only accordion built with Sass primarily for dynamic color scheming.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Dependencies: font-awesome.css, bootstrap.js, lastoftype.js
Author
Links
Made with
About a code
Accordion Multi Menu
Simple, stylish and modern vertical accordion menu.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery (UI-Less) Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Simple Sass/jQuery Accordion
CSS3/Sass/jQuery accordion that has some simple animations with arrows all done in CSS (sliding and click states done with jQuery).
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
jQuery Accordion Plugins
Author
Links
Made with
About a code
Accordion with jQuery
Simple accordion with jQuery.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Arai Accordion
HTML, CSS and JS accordion UI-component for scalable projects. User-friendly and accessible: WAI ARIA 1.1 compliant.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Ziehharmonika
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
Simple Jquery Multi Accordion
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery Accessible Accordion System
This jQuery plugin will transform a simple list of hx and div ’s into a fantastic-shiny accordion system, using ARIA.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Author
Links
Made with
About a code
jQuery Accordion
Responsive, CSS powered, jQuery accordion plugin. Jquery Accordion uses CSS transitions to animate opening/closing with a fallback to jQuery’s animate when CSS transitions are not supported. It takes little configuration or code to use it on your project.
Compatible browsers: Chrome, Edge, Firefox, Opera, Safari
Accordion
Displays collapsible content panels for presenting information in a limited amount of space.
Examples
Click headers to expand/collapse content that is broken into logical sections, much like tabs. Optionally, toggle sections open/closed on mouseover.
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is usable without JavaScript.
html>
html lang="en">
head>
meta charset="utf-8">
meta name="viewport" content="width=device-width, initial-scale=1">
title>jQuery UI Accordion - Default functionality title>
link rel="stylesheet" href="//code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css">
link rel="stylesheet" href="/resources/demos/style.css">
script src="https://code.jquery.com/jquery-3.6.0.js"> script>
script src="https://code.jquery.com/ui/1.13.2/jquery-ui.js"> script>
script>
$( function( )
$( "#accordion" ).accordion();
> );
script>
head>
body>
div id="accordion">
h3>Section 1 h3>
div>
p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
p>
div>
h3>Section 2 h3>
div>
p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
p>
div>
h3>Section 3 h3>
div>
p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
p>
ul>
li>List item one li>
li>List item two li>
li>List item three li>
ul>
div>
h3>Section 4 h3>
div>
p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
p>
p>
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
p>
div>
div>
body>
html>
Want to learn more about the accordion widget? Check out the API documentation.
Interactions
Widgets
Effects
Utilities
Books
Copyright 2023 OpenJS Foundation and jQuery contributors. All rights reserved. See jQuery License for more information. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation, please see our Trademark Policy and Trademark List. Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. OpenJS Foundation Terms of Use, Privacy, and Cookie Policies also apply. Web hosting by Digital Ocean | CDN by StackPath
How to make Accordion with HTML, CSS and jQuery
The accordion is a vertically stacked list of items. Each item can be “expanded” or “collapsed” to reveal the content associated with that item. There can be zero expanded items, exactly one, or more than one item expanded at a time, depending on the configuration.
Accordions are popular because they allow developers to force large amounts of content into tiny spaces on the page.
In this tutorial, I show how you can create the accordion using HTML, CSS, and jQuery.
Contents
1. HTML
Create a that contains accordion contents.
Using element for expand/collapse and create a following with .
Completed Code
2. CSS
By default set .accordion div element to display: none for not show all accordion section content to users when it first time load.
Completed Code
.accordion < width:70%; margin:0 auto; >/* accordion heading */ .accordion h1 < font-size:26px; font-weight: normal; text-align: center; margin-bottom:0px; margin-top:0px; background-color:gainsboro; padding-top:7px;padding-bottom:7px; border:1px solid darkgrey; border-radius:3px; >.accordion h1:hover < cursor:pointer; >/* accordion section content */ .accordion div < display:none; padding:10px; height:200px; line-height:20px; border:1px solid gray; border-radius:3px; >@media screen and (max-width:480px) < .accordion< width:100%; margin:0; >>
3. jQuery
On the click of element hide opened sections and show next element following with .
Completed Code
$(document).ready(function() < $(".accordion h1").click(function()< var /* getting heading id */ /* looping through all elements which have class .accordion-content */ $(".accordion-content").each(function()< if($("#"+id).next()[0].id != this.id)< $(this).slideUp(); >>); $(this).next().toggle(); /* Selecting div after h1 */ >); >);
4. Demo
5. Conclusion
I showed how you can create an accordion using HTML, CSS, and jQuery.
In the demonstration, I used element for the accordion header and expand/collapse sections when it gets clicked. You can use any other HTML element in the place of e.g. , , ,etc.
View this tutorial to know accordion creation using jQuery UI.
If you found this tutorial helpful then don't forget to share.