mgaccordion
v1.1.3
Published
Yet another accordion jQuery plugin
Downloads
16
Maintainers
Readme
#mgAccordion, yet another accordion jQuery plugin
Okay, there are a tons like this one, probably better, but his one is my first jQuery plugin and I love it.
It allows to initialize how many accordions in the same page using the standard unordered list.
By default, it uses a normal boxed layout, but you can choose the built-in 'tree' layout.
It provides a basic css you can customize as you prefer.
##Install
Clone or download the repo and extract files in your javascript folder then link them to your html page:
<link rel="stylesheet" type="text/css" href="mgaccordion.css"/>
<script type="text/javascript" src="mgaccordion.js"></script>
Finally, just initialize it:
$(document).ready(function () {
$('.my-list').mgaccordion();
});
##Options Currently you can set following options:
layout (string): default to 'flat' set it to 'tree' if you want to display the accordion with a tree structure leaveOpen (boolean): default to false (mgAccordion close all other submenus when you open a new one) set it to true if you want all opened submenus remain expanded when you open a new one
Change log
02/04/2020: * added check if element passed is an ul or an ol and exit silently if the check fails * removed unbind for the click event: this was needed only in an old version of the plugin written using jQueryUI