Skip to content

Commit

Permalink
fix/feat(esx_notify): use correct length and add animations correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Mycroft-Studios committed Nov 10, 2024
1 parent 970fcf7 commit a8940f5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions [core]/esx_notify/nui/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ notification = (data) => {
}
}

const id = Math.floor(Math.random() * Math.random());
const notification = $(`
<div class="notify ${data.type}">
<div id="${id}" class="notify ${data.type} fadeIn">
<div class="innerText">
<span class="material-symbols-outlined icon">${types[data.type] ? types[data.type]["icon"] : types["info"]["icon"]}</span>
<p class="text">${data["message"]}</p>
Expand All @@ -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;
};

0 comments on commit a8940f5

Please sign in to comment.