From 29fd5baaa31e1e27f9591a03540d0a4bb544bf09 Mon Sep 17 00:00:00 2001 From: Eduardo Ribas Date: Fri, 23 Jun 2023 08:02:50 -0300 Subject: [PATCH] feat: Adding a better destroy animation (#156) --- src/index.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 6829441..c73fbe8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -118,11 +118,17 @@ export class Toast { if (!el) return + el.style.opacity = '0' + el.style.visibility = 'hidden' + el.style.transform = 'translateY(10px)' + this.stopTimer() - container.removeChild(el) - instances.delete(this) - sortToast() + setTimeout(() => { + container.removeChild(el) + instances.delete(this) + sortToast() + }, 150) } /**