Press "Enter" to skip to content

A JavaScript Library That Implements An Toggleable Object Class Function | toggleElement.js

HTML toggle-element is a JavaScript library that implements a toggleable element class with a state change function called whenever the switch state changes.

jquery toggle between two classes, javascript toggle class onclick, toggle function javascript, javascript toggle between two classes, jquery toggle multiple classes

How to make use of it:

1. Import the toggleElement.js library into the HTML doc.

<script src="toggleElement.js"></script>

2. Add the <toggleable-element /> element to your app.

<toggleable-element id="example">
  Click Me
</toggleable-element>

3. Trigger a perform on the component when the state adjustments.

document.getElementById("example").onstatechange = ()=>{
  console.log(document.getElementById("example").state)
}

4. Apply corresponding CSS styles to the toggleable component.

#example {
  background: blue;
}

#example[state="on"]{
  background: red;
}

ON/OFF State Toggle, HTML toggle-element Plugin/Github


See Demo And Download

Official Website(creeperkafasi): Click Here

This superior jQuery/javascript plugin is developed by creeperkafasi. For extra Advanced Usages, please go to the official website.

Be First to Comment

    Leave a Reply

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