CodeSeven / toastr

Simple javascript toast notifications
http://www.toastrjs.com
MIT License
11.99k stars 2.04k forks source link

Open 2 different toastr with different options #302

Closed aleromano92 closed 9 years ago

aleromano92 commented 9 years ago

Hi, I'm trying to open (nearly) at the same time two different toasts, one in the top-right and one in the bottom-right.

toastr.info('Carico pianificazioni, registrazioni, ferie...', 'Caricamento', {
                "closeButton": false,
                "debug": false,
                "newestOnTop": true,
                "progressBar": true,
                "positionClass": "toast-top-right",
                "preventDuplicates": true,
                "onclick": null,
                "showDuration": "150",
                "hideDuration": "300",
                "timeOut": "4000",
                "extendedTimeOut": "1000",
                "showEasing": "swing",
                "hideEasing": "swing",
                "showMethod": "fadeIn",
                "hideMethod": "slideUp"
            });
toastr.info('Per qualsiasi problema o se non sei sicuro di come usare lo strumento, consulta le <a href="/extranet/pdf/FAQ.pdf" target="_blank">Frequently Asked Question</a>', 'FAQ', {
    "closeButton": true,
    "debug": false,
    "newestOnTop": false,
    "progressBar": true,
    "positionClass": "toast-bottom-right",
    "preventDuplicates": false,
    "onclick": null,
    "showDuration": "100",
    "hideDuration": "300",
    "timeOut": "10000",
    "extendedTimeOut": "3000",
    "showEasing": "swing",
    "hideEasing": "swing",
    "showMethod": "slideDown",
    "hideMethod": "slideUp"
});

But they are opening always with the options of the first one (first called).

How can i have different toasts in the same page? thank you

TimFerrell commented 9 years ago

What options specifically are being duplicated?

First thing that jumps out is that only one toast container can exist at a time. Containers are used to position the toasts.

If you are expecting the two toasts to appear in different locations at the same time, then that is not natively an option.

It is something that we are looking in to for v3.

aleromano92 commented 9 years ago

It just the position. Your answer about the container solved my question. Thank you