Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: toast options not working

BizRTC pro asked 5 years ago


Hi I am trying to use TOAST message to display error message.I want to show the error message in center bottom so I used the Toast Generator to create a toast message.

But somehow my message is always shown on top right corner.

I have added snippet Here

Below is my code :

<script>
    Command: toastr["error"]("Incorrect Username or Password!", "Error")

    toastr.options = {
      "closeButton": true,
      "debug": false,
      "newestOnTop": false,
      "progressBar": false,
      "positionClass": "md-toast-bottom-center",
      "preventDuplicates": false,
      "onclick": null,
      "showDuration": 30000,
      "hideDuration": 1000,
      "timeOut": 20000,
      "extendedTimeOut": 1001,
      "showEasing": "swing",
      "hideEasing": "linear",
      "showMethod": "fadeIn",
      "hideMethod": "fadeOut"
    }
</script>

What Am I doing wrong ?


Piotr Glejzer staff answered 5 years ago


Hi,

Check this out --> It's working ;)

Best,
Piotr


BizRTC pro commented 5 years ago

@Piotr Mine doesn't work ! What's wrong with my code ?


BizRTC pro commented 5 years ago

Infact when i set options the toast notification stops showing, without options it works but only with default settings


Bartłomiej Malanowski staff commented 5 years ago

Can you create a snippet where it doesn't work?


BizRTC pro commented 5 years ago

Yes I have created a Snippet here : https://mdbootstrap.com/snippets/jquery/bizrtc/323213?action=forum_info_modal


Piotr Glejzer staff commented 5 years ago

It's not working because you have to do it with that way: https://mdbootstrap.com/snippets/jquery/piotr-glejzer/325928


BizRTC pro commented 5 years ago

This does'nt work either for me! it show no toast at all. The only way i can see a toast message is though this code : toastr.error('My message.', 'Error!'); When i try other code or set any options it just does not show


Piotr Glejzer staff commented 5 years ago

So may you show me another code because I don't have a problem with the earlier code.


BizRTC pro commented 5 years ago

Currently My Code is this :

             `toastr["error"]("Incorrect Username or Password!", "Error", {
            "closeButton": true,
            "debug": false,
            "newestOnTop": false,
            "progressBar": false,
            "positionClass": "md-toast-bottom-center",
            "preventDuplicates": false,
            "onclick": null,
            "showDuration": 30000,
            "hideDuration": 1000,
            "timeOut": 20000,
            "extendedTimeOut": 1001,
            "showEasing": "swing",
            "hideEasing": "linear",
            "showMethod": "fadeIn",
            "hideMethod": "fadeOut"
          });`

And Scripts are:

`

`


BizRTC pro commented 5 years ago

No Matter what I add, the notfication is always shown on top right corner, no option that i set gets applied, infact if i add any option that it stops showing. Please tell me where I am wrong


BizRTC pro commented 5 years ago

Can you update me on this ?


BizRTC pro commented 5 years ago

It does not even show any error on browser console, so i am not sure how do to debug this. Its just that when I add any options it stops working! without options if i try it works with this code : toastr.warning('Hi! I am warning message.');


BizRTC pro commented 5 years ago

And just for information I am using the MDB Admin Dashboard Pro


Piotr Glejzer staff commented 5 years ago

so I checked this code on MDB Admin Pro/MDB Pro/snippets and it's working. We are using exactly the same code in MDB Admin Pro and in MDB Pro. I have no idea why it's is not working on your project. If you are showing me this code it's not enough to say something why it's not working. Do you use some other scripts or something what we not include in our packages? Did you clean cache?


BizRTC pro commented 5 years ago

I downloaded the latest SuperBundle-7.4.1 and it worked. I think its an issue with your older versions. Thanks!


BizRTC pro commented 5 years ago

I downloaded the latest SuperBundle-7.4.1 and it worked. I think its an issue with your older versions. Thanks!


BizRTC pro commented 5 years ago

So the last thing I wanna know which animation classes does it support ? As if add any from these it does not work : https://mdbootstrap.com/docs/jquery/css/animations/ I want to use other animations other than FadeIn and FadeOut


Piotr Glejzer staff commented 5 years ago

CSS animations work with the latest version. I created a snippet to show you. Did you use initiate function to start animations?

https://mdbootstrap.com/snippets/jquery/piotr-glejzer/370265


BizRTC pro commented 5 years ago

Can I add these to my Toast also ? Can you please create a snippet or guide me on how I can add animation to MDB Toast. I have already intialized it. Also i have put the latest Admin Pro Template and MDB Pro


Piotr Glejzer staff commented 5 years ago

In toast options only works a few animations (jQuery standard animations) like fadeIn, fadeOut, slideDown, slideUp, hide, show. You have to change this :

            "hideEasing": "linear",
        "showMethod": "fadeIn",
        "hideMethod": "fadeOut"

https://mdbootstrap.com/snippets/jquery/piotr-glejzer/370784


BizRTC pro commented 5 years ago

Okay works for me now! Thank you for all your help



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.6.1
  • Device: Windows
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes