Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Toastr: How to prevent fade out with sticky toast on mouseover?

I've been playing with toastr and have successfully set the timeout to 0 so the toast remains sticky, however the toast disappears when I mouse out of the toast. I'd like to override this so the toast only goes away if the user clicks it - ideal for toasts with lots of text. How can this be done?

like image 332
SB2055 Avatar asked Jul 01 '13 18:07

SB2055


2 Answers

Set extendedTimeOut to 0 too. That will keep it sticky.

like image 186
John Papa Avatar answered Sep 24 '22 18:09

John Papa


timeOut and extendedTimeOut must be set to 0.

Here is a complete example:

toastr.options = {
    timeOut: 0,
    extendedTimeOut: 0
};

toastr.info("Testing <button>blah</button>");

For those who wish to not close the toast on click, the example changes to:

toastr.options = {
    timeOut: 0,
    extendedTimeOut: 0,
    tapToDismiss: false
};

toastr.info("Testing <button>blah</button>");
like image 23
rynop Avatar answered Sep 21 '22 18:09

rynop