jQuery Easy Accordion Plugin – monica.js

The Monica.js is an ultra lightweight (about 1KB) jQuery and CSS based easy to use accordion plugin. It is useful to toggle FAQs or create general purpose accordion to expand and collapse contents. You can set your custom speed for sliding expandable contents.

Moreover, you can add multiple accordions on a single page. Besides this, it can be fully styled with additional CSS.

Plugin Overview

Plugin: monica.js
Author: Andreas Vifert Gylche
Licence: MIT Licence
Published: January 19, 2024
Repository: Fork on GitHub
Dependencies: jQuery 1.3.1 or Latest version
File Type: zip archive (HTML, CSS & JavaScript )
Package Size: 5.15 KB

How to Use jQuery Easy Accordion Plugin

1. After downloading this project, load jQuery and monica‘s CSS and JavaScript file into your HTML document.

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

<!-- Monica CSS -->
<script src="js/monica.js"></script>

<!-- Monica JS -->
<link href="css/monica.css" rel="stylesheet" type="text/css">

2. Create HTML structure for accordion like below:

<div class="monica">
   <h3 class="monicaTitle">Your Title 1</h3>
   <div class="moniceContent">
      <p>Your detailed contents goes here.</p>
   </div>
   <h3 class="monicaTitle">Your Title 2</h3>
   <div class="moniceContent">
      <p>Your title explaination. </p>
   </div>
   <h3 class="monicaTitle">Accodion Ttle 3</h3>
   <div class="moniceContent">
      <p> Details here.</p>
   </div>
</div>

Tip for Beginners:In the above HTML code, place your accordion title / question between <h3 class="monicaTitle"> tag. Similarly, add the detailed contents in <div class="moniceContent">.

3. Finally, initialize the plugin in jQuery document ready function.

$(document).ready(function() {
	
   $(".monica").monica();

});

4. To set the custom speed for slide up and down, use the following syntax.

$(".monica").monica({

            settings: {
                upTime: "slow",
                downTime: "slow"
            }
		
	});

The Possible options for speed are “slow” and “fast”. You can also set your custom speed in numbers (milliseconds), like:

settings: {
                upTime: 500,
                downTime: 600,
            }

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About CodeHim

Free Web Design Code & Scripts - CodeHim is one of the BEST developer websites that provide web designers and developers with a simple way to preview and download a variety of free code & scripts. All codes published on CodeHim are open source, distributed under OSD-compliant license which grants all the rights to use, study, change and share the software in modified and unmodified form. Before publishing, we test and review each code snippet to avoid errors, but we cannot warrant the full correctness of all content. All trademarks, trade names, logos, and icons are the property of their respective owners... find out more...