kamranahmedse / jquery-toast-plugin

Highly customizable jquery plugin to show toast messages
http://kamranahmed.info/toast
1.51k stars 506 forks source link

Cannot read property 'opts' of undefined with fancybox3 SOLVED #29

Closed Tsyklop closed 7 years ago

Tsyklop commented 7 years ago

I have next code:

$.toast({
    text: "Don't forget to star the repository if you like it.", // Text that is to be shown in the toast
    heading: 'Note', // Optional heading to be shown on the toast
    icon: 'warning', // Type of toast icon
    showHideTransition: 'fade', // fade, slide or plain
    allowToastClose: true, // Boolean value true or false
    hideAfter: 3000, // false to make it sticky or number representing the miliseconds as time after which toast needs to be hidden
    stack: 5, // false if there should be only one toast at a time or a number representing the maximum number of toasts to be shown at a time
    position: 'bottom-left', // bottom-left or bottom-right or bottom-center or top-left or top-right or top-center or mid-center or an object representing the left, right, top, bottom values
    textAlign: 'left',  // Text alignment i.e. left, right or center
    loader: true,  // Whether to show loader or not. True by default
    loaderBg: '#9EC600',  // Background color of the toast loader
    beforeShow: function () {}, // will be triggered before the toast is shown
    afterShown: function () {}, // will be triggered after the toat has been shown
    beforeHide: function () {}, // will be triggered before the toast gets hidden
    afterHidden: function () {}  // will be triggered after the toast has been hidden
});

And i get next error with fancybox3. How fix this?

jquery.fancybox.js:4821 Uncaught TypeError: Cannot read property 'opts' of undefined
    at HTMLDocument.beforeShow.fb (jquery.fancybox.js:4821)
    at HTMLDocument.dispatch (jquery.min.js:3)
    at HTMLDocument.q.handle (jquery.min.js:3)
    at Object.trigger (jquery.min.js:4)
    at HTMLDivElement.<anonymous> (jquery.min.js:4)
    at Function.each (jquery.min.js:2)
    at r.fn.init.each (jquery.min.js:2)
    at r.fn.init.trigger (jquery.min.js:4)
    at Object.animate (jquery.toast.min.js:1)
    at Object.process (jquery.toast.min.js:1)
Tsyklop commented 7 years ago

In JS file find string "beforeShow", and replace it with "befoewShown"