Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add closeIcon option #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/toastify.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
destination: undefined,
newWindow: false,
close: false,
closeIcon: "✖",
gravity: "toastify-top",
positionLeft: false,
position: '',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down