From 5d3fd85dd9c822a5126dfa9737fd4c95b1bf9008 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 24 Jun 2023 22:28:08 +0200 Subject: sideui animation --- client-web/source/menu.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client-web/source/menu.ts') diff --git a/client-web/source/menu.ts b/client-web/source/menu.ts index 1b159ec..041dcdf 100644 --- a/client-web/source/menu.ts +++ b/client-web/source/menu.ts @@ -51,8 +51,17 @@ export function side_ui(container: HTMLElement, content: HTMLElement, label: str // TODO: close other side uis const checkbox = einput("checkbox", { onchange: () => { - if (checkbox.checked) container.appendChild(content) - else container.removeChild(content) + if (checkbox.checked) { + container.classList.add("animate-in") + container.appendChild(content) + } else { + container.classList.remove("animate-in") + container.classList.add("animate-out") + setTimeout(() => { // TODO breaks if ui is being enabled while timeout is active + container.classList.remove("animate-out") + container.removeChild(content) + }, 400) + } } }) return { -- cgit v1.2.3-70-g09d2