@lordicon/element
Version:
This package offers developers a convenient method for embedding, controlling, and customizing animated icons from Lordicon within web projects.
13 lines (10 loc) • 381 B
text/typescript
import { defineElement } from "../src";
defineElement();
const listElement = document.getElementById("list")!;
const items = Array.from(listElement.querySelectorAll("div"));
items.forEach((item) => {
item.addEventListener("click", () => {
items.filter(c => c !== item).forEach((el) => el.classList.remove("active"));
item.classList.add("active");
});
});