-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
I'm currently struggling to control the position of toastr container on page.
The container element is inserted on the page by me but is destroyed after the first notification and I can't give the style I want on the second (auto generated) container element appended to the body.
I found that if I added an empty span to the container, the element is not destroyed, but with preventDuplicates option set to true, it does not work well:
function removeToast($toastElement) {
if (!$container) { $container = getContainer(); }
if ($toastElement.is(':visible')) {
return;
}
$toastElement.remove();
$toastElement = null;
if ($container.children().length === 0) {
$container.remove();
previousToast = undefined;
}
}
And so the previousToast is not unset (as it should).
The result is - when a message is displayed and closed, and a new and equal one is created, it is not displayed (because previousToast was not unset and so toastr thinks the first one is still being displayed).
I couldn't find any other solution to this specific problem, and I believe that it would be really simple to add an option to control the remove action (true/false) of the container element so that everything would work smoothly.