From f6e62467cea04521733e10ace744ec868ad9b808 Mon Sep 17 00:00:00 2001 From: Cordell Calitz Date: Tue, 6 Aug 2024 09:07:07 +0200 Subject: [PATCH] Add closeIcon option --- src/toastify.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/toastify.js b/src/toastify.js index 5d9659c..e30668d 100644 --- a/src/toastify.js +++ b/src/toastify.js @@ -32,6 +32,7 @@ destination: undefined, newWindow: false, close: false, + closeIcon: "✖", gravity: "toastify-top", positionLeft: false, position: '', @@ -74,6 +75,7 @@ this.options.destination = options.destination || Toastify.defaults.destination; // On-click destination this.options.newWindow = options.newWindow || Toastify.defaults.newWindow; // Open destination in new window this.options.close = options.close || Toastify.defaults.close; // Show toast close icon + this.options.closeIcon = options.closeIcon || Toastify.defaults.closeIcon; // Text to use as toast close icon this.options.gravity = options.gravity === "bottom" ? "toastify-bottom" : Toastify.defaults.gravity; // toast position - top or bottom this.options.positionLeft = options.positionLeft || Toastify.defaults.positionLeft; // toast position - left or right this.options.position = options.position || Toastify.defaults.position; // toast position - left or right @@ -171,7 +173,7 @@ closeElement.type = "button"; closeElement.setAttribute("aria-label", "Close"); closeElement.className = "toast-close"; - closeElement.innerHTML = "✖"; + closeElement.innerHTML = this.options.closeIcon; // Triggering the removal of toast from DOM on close click closeElement.addEventListener(