A Simple Accessible Show-and-Hide/Accordion Script | houdini

Houdini is a simple accessible show-and-hide/accordion script. Houdini gradually improves the codec as it loads. You provide content and Houdini layers in toggle buttons, ARIA themes, and interaction on your behalf.

Table of Contents

what’s new?

  • Supports multiple creations simultaneously.
  • Ease of access and better connotations.
  • It automatically improves your coding incrementally.
  • Deprecated callbacks in favor of custom events.


Houdini includes smart defaults and works right out of the box. But if you want to customize things, it also has a powerful API that provides you with multiple ways to set default options and settings.

How to make use of it:

1. Import Houdini files (JavaScript and Stylesheet) to the page.

<!-- stylesheets -->
<link rel="stylesheet" href="dist/css/houdini.css">
<!-- Javascript -->
<script src="dist/js/houdini.js"></script>

2. Configure the Houdini library.


3. Create a widget that switches the main content.

<a class="collapse-toggle" data-collapse href="#show-me">
  <span class="collapse-text-show">Show +</span>
  <span class="collapse-text-hide">Hide -</span>
<div class="collapse" id="show-me">
  Target content

4. Create a basic accordion widget that supports multiple content blocks and only one block should be visible at a time.

<a class="collapse-toggle active" data-collapse data-group="accordion" href="#section1">
  Section 1
  <span class="collapse-text-show">+</span>
  <span class="collapse-text-hide">-</span>
<div class="collapse active" id="section1">
  Section 1 Content
<a class="collapse-toggle active" data-collapse data-group="accordion" href="#section2">
  Section 2
  <span class="collapse-text-show">+</span>
  <span class="collapse-text-hide">-</span>
<div class="collapse active" id="section2">
  Section 2 Content
<a class="collapse-toggle active" data-collapse data-group="accordion" href="#section3">
  Section 3
  <span class="collapse-text-show">+</span>
  <span class="collapse-text-hide">-</span>
<div class="collapse active" id="section3">
  Section 3 Content

5. Default settings.

  selectorToggle: '[data-collapse]',
  selectorContent: '.collapse',
  toggleActiveClass: 'active',
  contentActiveClass: 'active',
  initClass: 'js-houdini',
  stopVideo: true

6. Callback functions will be triggered when content is shown or hidden.

  callbackOpen: function () {},
  callbackClose: function () {}

Custom Events

Houdini emits five custom events:

  • houdiniExpand is emitted on a content element after it’s expanded.
  • houdiniCollapse is emitted on a content element after it’s collapsed.
  • houdiniInitialize is emitted  document when the script is initialized, but before the DOM is set up.
  • houdiniSetup is emitted  document after the DOM is set up.
  • houdiniDestroy is emitted  document after initialization is destroyed.

On the houdiniExpand  houdiniCollapse the event, the event.detail object includes the content and button. For the houdiniInitializehoudiniSetup, and houdiniDestroy the event includes the settings object.

accordion & content toggle js, Houdini Plugin/Github/Codepen

See Demo And Download

Official Website(cferdinandi): Click Here

This superior jQuery/javascript plugin is developed by cferdinandi. For extra advanced usage, please go to the official website.

Related Posts


Responsive Drag and Drop File Uploader/Download Plugin | 5x5_jq_uploader

5x5_jq_uploader plugin can be used to instantly create a drop file area and file queue with a little bit of preparation. Bootstrap is used for responsive planning…


Stylesheet For Implementing Dark Mode with Bootstrap

Bootstrap Dark Mode provides a style sheet and two texts that allow you to implement Dark Mode on your website. Initially loaded based on user preferences, can…


Multi-purpose Navigation Menu for Javascript Library | jQuery Corenav

coreNavigation is a multipurpose navigation menu for a jquery based javascript library, comes with more style, and is easy to integrate. 11 Default Menu 2 Responsive Navigation…


Simple Multi-Select Dropdown Pure Vanilla Javascript | multiSelect.js

MultiSelect.js is a simple, clean, and progressive JavaScript library designed for easy integration with any type of project or system. The design was heavily influenced by the…


Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…


How To Create A Popup in HTML with CSS

How to create popup in html with css – Popup without JavaScript is an elegant pop-up panel component with an animated scale, written in CSS. Have you…