ClubCola
ClubCola

Reputation: 69

Toastr - issue with the options

I called a toastr message via

Command: toastr["success"]("foo")

toastr.options = {
  "closeButton": false,
  "debug": false,
  "newestOnTop": false,
  "progressBar": false,
  "positionClass": "toast-bottom-right",
  "preventDuplicates": false,
  "onclick": null,
  "showDuration": "300",
  "hideDuration": "1000",
  "timeOut": "2000",
  "extendedTimeOut": "1000",
  "showEasing": "swing",
  "hideEasing": "linear",
  "showMethod": "fadeIn",
  "hideMethod": "fadeOut"
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script>

It seems the options have no effect, the timeOutand the positionClass were not overridden.

May somebody give me a info whats wrong?

Upvotes: 1

Views: 5301

Answers (2)

ramin bakhshpour
ramin bakhshpour

Reputation: 79

you should change your jquery version if 1.2.3 is the version you use, i built a jsbin and tested it. Just try it with a newer version for e.g "1.9.1". if you need to stick to 1.2.3 try another version of toastr compatible with jquery 1.2.3.

here is the jsbin: https://jsbin.com/rufuganane/edit?html,output

Upvotes: 0

Microfed
Microfed

Reputation: 2890

I think you should change options before the first call of toastr's methods (info, success, etc.)

Upvotes: 1

Related Questions