Prevent Closing Toastr Click

I try to keep toastr open always, but it disappears when I click on it, I set extendedTimeOut = 0, however toastr disappears when I click on it, so I need it to never close even when I click on it

+7
javascript onclick notifications toastr
source share
2 answers

I found the toastr option to do this

toastr.options.tapToDismiss = false 

Example: https://jsfiddle.net/w96udv4e/5/

+16
source share

try to add

 event.stopPropogation() 

upd link to the code

UPD: in the sources it calls

 return $toastElement[options.hideMethod](...); 

so you need to set these parameters in a jquery function that will work on $ toastElement that does nothing, something like the "end" function, but you can make the noop function on all jquery elements and make hideMethod equal to "noop":

 $.fn.noop = function(){return this;}; toastr.options.hideMethod = 'noop'; 

fiddle reference

0
source share

All Articles