0.1.2 • Published 3 years ago

@buuug7/simplify-switch v0.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

simplify switch

Install

install @buuug7/simplify-switch package via npm, and then import from @buuug7/simplify-switch/index.css file.

npm install @buuug7/simplify-switch

Demo examples

Usage

<div class="switch"></div>
<div class="switch active"></div>

use javascript

document.querySelectorAll(".switch").forEach(function (node) {
  node.addEventListener("click", function (e) {
    const t = e.target.closest(".switch");
    const active = t.classList.contains("active");
    active ? t.classList.remove("active") : t.classList.add("active");
  });
});
0.1.2

3 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

4 years ago