Lightweight and Easy Configurable Multilevel Accordion – Accordion.JS

Looking for a affordable website?

GET STARTED
www.codingexpertz.com
Lightweight and Easy Configurable Multilevel Accordion – Accordion.JS

File Size: 90KB

Total Views: 36

Date Created:

Last Modified Date:

Official Website: Go to website

License: MIT

Accordion.JS is lightweight, easily configurable and multilevel supported responsive accordion plugin. The plugin is automatically adjustable on mobile devices no extra coding is required for mobile devices. It will work perfectly on all mobile devices and browsers. It can be configured directly using options and HTML5 data-* attributes.

Features:

  • Multilevel supported.
  • Lightweight and easy to implement.
  • Supports data-* attributes to configure various options.
  • Supports on devices and browsers.
  • Fully responsive, no need to do anything for responsiveness.

Install with npm

npm install accordionjs --save

Install with yarn

yarn add accordionjs

How to use it:

1. Include the Javascript accordion.min.js at the bottom of the web page.

<script src="path/to/accordion.min.js"></script>

2. Include the CSS accordion.css in the header of the page.

<link rel="stylesheet" href="path/to/accordion.css">

3. Add the basic HTML to the page.

<ul id="my-accordion" class="accordionjs">

    <!-- Section 1 -->
    <li>
        <div>Section 1 title</div>
        <div>
            <!-- Section content here. -->
        </div>
    </li>

    <!-- Section 2 -->
    <li>
        <div>Section 2 title</div>
        <div>
            <!-- Section content here. -->
        </div>
    </li>

    <!-- Section 3 -->
    <li>
        <div>Section 3 title</div>
        <div>
            <!-- Section content here. -->
        </div>
    </li>

</ul>

4. Initialize the plugin and we’re ready to go.

jQuery(document).ready(function($){
  $("#my-accordion").accordionjs();
});

Plugin’s default options:

Name Default Description
closeAble false Allow self close.(data-close-able)
closeOther true Close other sections.(data-close-other)
slideSpeed 150 Animation Speed.(data-slide-speed)
activeIndex 1 The section open on first init. A number from 1 to X or false.(data-active-index)
openSection function( section ){} Callback when a section is open
beforeOpenSection function( section ){} Callback before a section is open
$("#my-accordion").accordionjs({
    closeAble   : false,
    closeOther  : true,
    slideSpeed  : 150,
    activeIndex : 1,
    openSection: function( section ){},
    beforeOpenSection: function( section ){},
});

Leave a comment

Your email address will not be published. Required fields are marked *

STAYUPDATED

Receive all our future posts instantly in your inbox. Enter your email to enroll.