Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

199
Visualizações
Toastr - timeout=0 onclick=function(){} how do I hide the toastr?

With the code below (taken from the demo page, with callbacks added) my toaster pops up and doesn't time out, which is what I want. I then want the user to have to press one of the buttons.

If I clicks on the background it disappears. If I clicks on a button the callback happens but the toastr doesn't disappear.

How do I make the toastr disappear when the buttons are clicked? How do I make the toastr stay when the background is clicked?

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");
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda