diff --git a/demo.html b/demo.html
index 7e124d68..f89f1b9d 100644
--- a/demo.html
+++ b/demo.html
@@ -10,6 +10,10 @@
.row {
margin-left: 0;
}
+ .toast-custom {
+ background-color: #0000A0;
+ background-image: url("data:image/gif;base64,R0lGOD lhCwAOAMQfAP////7+/vj4+Hh4eHd3d/v7+/Dw8HV1dfLy8ubm5vX19e3t7fr 6+nl5edra2nZ2dnx8fMHBwYODg/b29np6eujo6JGRkeHh4eTk5LCwsN3d3dfX 13Jycp2dnevr6////yH5BAEAAB8ALAAAAAALAA4AAAVq4NFw1DNAX/o9imAsB tKpxKRd1+YEWUoIiUoiEWEAApIDMLGoRCyWiKThenkwDgeGMiggDLEXQkDoTh CKNLpQDgjeAsY7MHgECgx8YR8oHwNHfwADBACGh4EDA4iGAYAEBAcQIg0Dk gcEIQA7") !important;
+ }
@@ -93,6 +97,13 @@
toastr
+
+
+
+
+
@@ -215,6 +226,15 @@
Links
return msg;
};
+ $('#toastTypeGroup').click(function() {
+ var toastType = $("#toastTypeGroup input:radio:checked").val();
+ if (toastType === 'custom') {
+ $('#customClassContainer').show();
+ } else {
+ $('#customClassContainer').hide();
+ }
+ });
+
$('#closeButton').click(function() {
if($(this).is(':checked')) {
$('#addBehaviorOnToastCloseClick').prop('disabled', false);
@@ -249,6 +269,9 @@ Links
preventDuplicates: $('#preventDuplicates').prop('checked'),
onclick: null
};
+ if (shortCutFunction === 'custom') {
+ toastr.options.iconClass = $('#customClass').val();
+ }
if ($('#addBehaviorOnToastClick').prop('checked')) {
toastr.options.onclick = function () {
diff --git a/tests/unit/toastr-tests.js b/tests/unit/toastr-tests.js
index 71b704e7..d16f8927 100644
--- a/tests/unit/toastr-tests.js
+++ b/tests/unit/toastr-tests.js
@@ -20,7 +20,7 @@
var selectors = {
container: 'div#toast-container',
toastInfo: 'div#toast-container > div.toast-info',
- toastWarning: 'div#toast-container > div.toast-success',
+ toastWarning: 'div#toast-container > div.toast-warning',
toastError: 'div#toast-container > div.toast-error',
toastSuccess: 'div#toast-container > div.toast-success'
};
diff --git a/toastr.js b/toastr.js
index f48cb73d..522048ea 100644
--- a/toastr.js
+++ b/toastr.js
@@ -21,11 +21,13 @@
error: 'error',
info: 'info',
success: 'success',
- warning: 'warning'
+ warning: 'warning',
+ custom: 'custom'
};
var toastr = {
clear: clear,
+ custom: custom,
remove: remove,
error: error,
getContainer: getContainer,
@@ -99,6 +101,16 @@
});
}
+ function custom(message, title, optionsOverride) {
+ return notify({
+ type: toastType.custom,
+ iconClass: getOptions().iconClass,
+ message: message,
+ optionsOverride: optionsOverride,
+ title: title
+ });
+ }
+
function clear($toastElement, clearOptions) {
var options = getOptions();
if (!$container) { getContainer(options); }