d3-fc-switcher
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

D3-FC switcher

Lightweight implementation of html class switcher (toggling class)

Useful for fast prototyping, when you need fast toggle classes on dom elements

Demo

Try it out ->

Interface

Install

  • npm: npm install d3-fc-switcher
  • yarn: yarn add d3-fc-switcher

Usage

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

Package Sidebar

Install

npm i d3-fc-switcher

Weekly Downloads

4

Version

0.1.3

License

MIT

Unpacked Size

351 kB

Total Files

18

Last publish

Collaborators

  • d3-fc