From a8940f59500bcf7a19eab1d6354be57f1574cfcc Mon Sep 17 00:00:00 2001 From: Kasey FItton Date: Sun, 10 Nov 2024 12:13:35 +0000 Subject: [PATCH] fix/feat(esx_notify): use correct length and add animations correctly --- [core]/esx_notify/nui/js/script.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/[core]/esx_notify/nui/js/script.js b/[core]/esx_notify/nui/js/script.js index 54c89967c..640025219 100644 --- a/[core]/esx_notify/nui/js/script.js +++ b/[core]/esx_notify/nui/js/script.js @@ -57,8 +57,9 @@ notification = (data) => { } } + const id = Math.floor(Math.random() * Math.random()); const notification = $(` -
+
${types[data.type] ? types[data.type]["icon"] : types["info"]["icon"]}

${data["message"]}

@@ -67,8 +68,16 @@ notification = (data) => { `).appendTo(`#root`); setTimeout(() => { - notification.fadeOut(70); - }, 10000); + document.getElementById(id).classList.remove("fadeIn"); + }, 300); + + setTimeout(() => { + document.getElementById(id).classList.add("fadeOut"); + + setTimeout(() => { + document.getElementById(id).remove(); + }, 400); + },data.length); return notification; };