Lightweight implementation of html class switcher (toggling class)
Useful for fast prototyping, when you need fast toggle classes on dom elements
- npm:
npm install d3-fc-switcher - yarn:
yarn add d3-fc-switcher
In your main js file
import { Switcher } from 'd3-fc-switcher'
Switcher.makeDefault()Then you can use in your html template
<div data-switchable="switchable1" data-switchable-class="active"></div>
<button data-switcher="switchable1">switcher</button>When button is clicked script will add '.active' class to your switchable div.
When button is clicked second time script will remove '.active' from div
