Sticky toastr onclick事件的关闭按钮

Cra*_*gly 1 jquery toastr

有没有办法在用户点击通知或点击关闭按钮后执行操作?目前我可以使用options.onclick事件做第一个选项.但是我无法看到如何在关闭按钮上执行此操作.或者,有没有办法可以对通知淡出执行我的操作?

toastr.options = {
    "closeButton": true,
    "timeOut": "0",
    "extendedTimeOut": "0"
};
toastr.options.onclick = function () {
    console.log("Notification clicked");
};
toastr.success("Success, Whooo!!");
Run Code Online (Sandbox Code Playgroud)

小智 9

你不能在点击上做得很好,因为没有回调.您可以在按钮上使用jquery实时处理程序.

关于淡出后的通知,请使用此;

 toastr.options.onHidden = function() { console.log("onHide"); };
Run Code Online (Sandbox Code Playgroud)