Toggle State Of DOM Element – easy-toggle-state

Category: Javascript , Recommended | July 15, 2018
Author: Twikito
Views Total: 283
Official Page: Go to website
Last Update: July 15, 2018
License: MIT

Preview:

Toggle State Of DOM Element – easy-toggle-state

Description:

easy-toggle-state is a pure JavaScript library to toggle the state of any elements using UI components such as Checkbox, Radio button, Tooltip, Accordion, Tabs, Lightbox, etc.

The main goal of this library is to toggle the CSS class of an element when the element or another element is clicked.

Basic usage:

Install the library with NPM:

# NPM
$ npm install easy-toggle-state --save

Or download the zip and then include the main JavaScript file on the webpage.

<script src="easy-toggle-state.es6.min.js"></script>

Specify the active class when an element is clicked. The default active class is is-active.

<element data-toggle-class="active-class">
</element>

Also apply the active class to another element:

<element data-toggle-class="active-class"
         data-toggle-target="target-element">
</element>

Apply the active class to all child elements in a parent element.

<element data-toggle-class="active-class"
         data-toggle-target-parent="target-element">
</element>

Apply the active class to all sub-elements in itself.

<element data-toggle-class="active-class"
         data-toggle-target-self="selector">
</element>

Apply the active class to previous/next elements.

<element data-toggle-class="active-class"
         data-toggle-target-previous>
</element>

<element data-toggle-class="active-class"
         data-toggle-target-next>
</element>

Changelog:

v1.7.0 (07/04/2018)

  • Sizes update

v1.6.5 (07/04/2018)

  • update

v1.6.4 (06/30/2018)

  • No more IE polyfills

v1.6.1 (06/28/2018)

  • Escape key management fix

v1.6.1 (06/27/2018)

  • bugfix

v1.6.0 (06/20/2018)

  • bugfix

v1.5.5 (06/14/2018)

  • bugfix

v1.5.3 (06/06/2018)

  • Update

v1.5.0 (06/01/2018)

  • Code optimizations

v1.4.2 (05/31/2018)

  • IE11 version now working

v1.4.2 (05/24/2018)

  • Better aria management

Leave a Reply