Toggle CSS Classes With Pure JavaScript – ClassToggle.js

Category: Javascript | December 28, 2018
Author: mvdschee
Views Total: 164 views
Official Page: Go to website
Last Update: December 28, 2018
License: MIT


Toggle CSS Classes With Pure JavaScript – ClassToggle.js


ClassToggle.js is a small and reusable JavaScript library used to toggle CSS classes with custom triggers.

How to use it:

Place the minified version of the ClassToggle.js library at the bottom of the web page.

<script src="ClassToggle.min.js"></script>

Create triggers and associated elements as follows:

<span id="1_trigger" class="execute_1">click on me</span>
<span id="2_trigger" class="execute_2">click on me</span>
<span class="execute_1">1</span>
<span class="execute_2">2</span>
<span class="execute_1">3</span>
<span class="execute_2">4</span>
<span class="execute_1">5</span>

Apply custom CSS styles to the elements.

[class*=execute].active { background: #ccf }

[id*=trigger].active:hover { background: #66f }



  • v0.1.0

You Might Be Interested In:

Leave a Reply