CodeSeven / toastr

Simple javascript toast notifications

Home Page:http://www.toastrjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jQuery.easing[jQuery.easing.def] is not a function

rbdeenk opened this issue · comments

This fix is meant for people that use a cdn to import the file or a downloaded version of the file on their device/ server.

I have found out that this library creates a flood of errors when you are using the mdbootstrap library on your page.
To fix this missmatch you can get the script at the location you want to call the script:

var url = "The url you use to import the toastr.js file"

$.ajaxSetup({ cache: true });
$.getScript(url, function () {
        toastr.options = {
            "positionClass": "toast-bottom-right"
        };
        
        toastr.success('widget is toegevoegd');
});
$.ajaxSetup();

$.ajaxSetup Sets default values for future Ajax requests.
$.getScript() Load a JavaScript file from the server using a GET HTTP request, then execute it.

Make sure to cache the script using $.ajaxSetup({ cache: true }) and removing this again using $.ajaxSetup() so it only applies to this function. Be aware that this overwrites any other $.ajaxSetup() settings you have set before.
Also note that you should remove the Script tags for toastr in your html since you are retrieving the files in the code above.

If anyone has different ideas or maybe a cleaner fix/ solution to this issue I would gladly hear about them.