Script47 / Toast

A Bootstrap 4.2+ jQuery plugin for the toast component
https://shrtn.onl/EY
MIT License
152 stars 43 forks source link

Setting stackable to true does not stack #28

Closed Greensahil closed 4 years ago

Greensahil commented 4 years ago

First of all, I wanted to thank you for this amazing plugin. I have been using this for the past 2 years. I have chatted with you in stackoverflow about new features and I did not realize that you have continued working on this. I am using this module to handle all of my jquery post errors:

$(function() {
    $.ajaxSetup({
        error: function(jqXHR, exception) {
            $.toast({
                position: 'top-right', /** top-left/top-right/top-center/bottom-left/bottom-right/bottom-center - Where the toast will show up **/
                dismissible: true, /** true/false - If you want to show the button to dismiss the toast manually **/
                stackable: true, /** true/false - If you want the toasts to be stackable **/
                pauseDelayOnHover: true, /** true/false - If you want to pause the delay of toast when hovering over the toast **/
                title: jqXHR.statusText,
                subtitle: jqXHR.status,
                content: jqXHR.responseJSON.message,
                type: 'error',
                delay: 5000
            });
        }
    });
});

As you can see I have set stackable to true. But my toasts are not stacking. I am not sure what that does. If the contents of the toast are exactly the same wouldn't it be better to immediately remove the previous toast and replace it with new toast. This should create kind of a flashing effect so that the user knows they fired the same error.

Script47 commented 4 years ago

@Greensahil

I appreciate the kind words. It's always nice to hear that someone is benefiting of something you created.

With regards to your issue, you need to set stackable in the toastDefaults, not in the actual toast configuration.

I'm going to close the issue, feel free to open it to clarify or if this issue still persists.