关闭按钮的粘性烤面包机onclick事件 [英] Sticky toastr onclick event of close button

查看:94
本文介绍了关闭按钮的粘性烤面包机onclick事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在用户单击通知或单击关闭按钮之后,是否可以执行操作?目前,我可以使用options.onclick事件执行第一个选项.但是,我看不到如何在关闭按钮上执行此操作.或者,有什么方法可以使我的通知淡出吗?

Is there a way I can perform an action after a user either clicks on the notification or clicks on the close button? At the moment I can do the first option using the options.onclick event. However I can not see how I can do this on the close button. Alternatively is there a way it could perform my action on the notification fading out?

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

推荐答案

单击时效果不佳,因为没有回调.您可以在按钮上使用jquery实时处理程序.

You can't do it nicely on click, because there is no callback. You could use a jquery live handler on the button.

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

About the notification after fading out, use this;

 toastr.options.onHidden = function() { console.log("onHide"); };

这篇关于关闭按钮的粘性烤面包机onclick事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆