且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 Bootstrap 模式上打开 URL 关闭

更新时间:2022-12-17 13:12:40

$(".modal").on("hidden.bs.modal", function () {
    window.location = "your-url";
});

http://getbootstrap.com/javascript/#modals-usage

您还可以(这可能是一个更好的选择)向用户必须单击的按钮添加 onclick 处理程序(因为 hidden.bs.modal当用户按下 Esc 或单击 x 按钮关闭模式时,也会触发事件.

You could also (and that is probably a better option) add a onclick handler to the button that the user has to click (because the hidden.bs.modal event also fires when the user closes the modal by pressing Esc or clicking the x button.