jQuery Accordion with Plus Minus Icons

Yet another lightweight and multi-features jQuery plugin to create accordion with plus minus icons. The accordion expand and collapse div contents with smooth CSS transitions. Moreover, it can be fully customize with CSS and with plugin’s options.

Plugin Overview

Plugin: cssCollapse
Author: Riccardo Andreatta
Licence: MIT Licence
Published: January 17, 2024
Repository: Fork on GitHub
Dependencies: jQuery 1.3.1 or Latest version
File Type: zip archive (HTML, CSS & JavaScript )
Package Size: 214 KB

How to Make jQuery Accordion with Plus Minus

1. Load the latest version of jQuery and accordion’s Js & CSS files into HTML document.

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

<!-- Accordion CSS -->
<link rel="stylesheet" type="text/css" href="dist/css/app.css">

<!-- Accordion JS -->
<script type="text/javascript" src="dist/js/app.min.js"></script>

2. Create markup structure for accordion as follows.

<article class="myAccordion">
 <div class="wrapBoxContent">
   <div class="button cssCollapse-target cssCollapse-noScroll">
      <span class="cssCollapse-collapseIcons cssCollapse-plus"></span>
      <span class="cssCollapse-text">Collapse</span>
   </div>
   <div class="boxHidden cssCollapse-hiddenContent">
      <div class="innerText">
         <p>
            Your Accordion Contents Goes Here...
         </p>
      </div>
   </div>
 </div>
</article>

3. Finally initialize the plugin in jQuery document ready function with the following options for creating accordion with plus minus icons.

$(document).ready(function(){

   $('.myAccordion').cssCollapse({
                iconClose: 'dash',
                iconOpen: 'plus'
   });

});

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...

Please Rel0ad/PressF5 this page if you can't click the download/preview link

X