【问题标题】:Twitter Bootstrap Modal, bind to close button and get clicked elementTwitter Bootstrap Modal,绑定到关闭按钮并获得点击元素
【发布时间】:2015-11-11 10:03:56
【问题描述】:

使用这个我可以在模态关闭时做一些事情

$(".something").on('hidden.bs.modal', function (e) {
    alert("closed");
});

e 事件不包含有关用于关闭模式的元素的任何内容。当然,它可能不是一个元素,它可能是一个键或单击,只是“关闭”模式。但是我仍然想知道点击了哪个元素来隐藏模式,如果有的话。

覆盖关闭按钮上的点击事件只是正确停止了模式关闭。它会消失,但模态淡入淡出区域仍然存在。

有什么想法吗?

【问题讨论】:

    标签: jquery twitter-bootstrap modal-dialog


    【解决方案1】:

    让 Bootstrap 插件事件转发导致它们的底层 originalEvent 是一个已知问题,它将包含在 v4 中。

    同时您可以查看以下替代解决方案:

    https://github.com/twbs/bootstrap/issues/15408

    bootstrap how to detect which button closed a modal dialog on 'hidden_modal_bs' event func?

    【讨论】:

    • 谢谢。我想,请为 v4 的到来举杯。
    猜你喜欢
    • 2021-08-30
    • 2021-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-19
    • 2023-04-08
    • 1970-01-01
    相关资源
    最近更新 更多