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

timeout=0 onclick=function(){} how do I hide the toastr? #680

Open
GStainburn opened this issue Jan 6, 2022 · 1 comment
Open

timeout=0 onclick=function(){} how do I hide the toastr? #680

GStainburn opened this issue Jan 6, 2022 · 1 comment

Comments

@GStainburn
Copy link

GStainburn commented Jan 6, 2022

With the code below (taken from the demo page, with callbacks added) my toaster pops up and doesn't time out.
If I click the button the callback happens but the toastr doesn't disappear.

How do I make it disappear please?

Also, if I click the background, it does disappear. How can I prevent this?

toastr.options = { "closeButton": false,
                   "debug": false,
                   "newestOnTop": false,
                   "progressBar": false,
                   "positionClass": "toast-bottom-right",
                   "preventDuplicates": false,
                   "showDuration": "700",
                   "hideDuration": "1000",
                   "timeOut": "0",
                   "extendedTimeOut": "0",
                   "showEasing": "swing",
                   "hideEasing": "linear",
                   "showMethod": "fadeIn",
                   "hideMethod": "fadeOut"};
toastr.options.onShown = function() { console.log('hello'); }
toastr.options.onHidden = function() { console.log('goodbye'); }
toastr.options.onclick = function(e) { console.log('clicked');console.log(e); }
toastr.options.onCloseClick = function() { console.log('close button clicked'); }
msg="This is a test<br /><br />"+
    "<button type='button' class='btn clear id=Yes'>Yes</button> "+
    "<button type='button' class='btn clear id=No'>No</button>";
var TOAST=toastr['error'](msg,"Alert");
@Go1dExperience
Copy link

In the code it said setting both timeOut and extendedTimeOut to 0 will make the toast sticky. I've tried with timeOut=0 and extendedTimeOut to be any other numbers, and it seems to be working how you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants