在Bootstrap Modal上打开URL关闭
也许我在这里脑子死了,但我正在尝试做似乎应该很容易的事情.
Maybe I'm brain dead here, but I'm trying to do what seems should be an easy thing.
我正在使用Bootstrap在页面加载时打开模式,具体取决于特定变量的值.这一切都很好.但是,当模式打开并且用户单击确定"(大概在阅读了信息文本之后)时,我想翻页以重定向到新页面.我似乎不知道该怎么做.
I am using Bootstrap to open a modal on page load depending on the value of specific variables. This all works great. However, when the modal opens and the user clicks ok (presumably after reading the info text), I want to page to redirect to a new page. I can't seem to figure out how to do this.
有关如何操作的任何信息
Any info on how to do
$(".modal").on("hidden.bs.modal", function () {
window.location = "your-url";
});
http://getbootstrap.com/javascript/#modals-usage
您还可以(这可能是一个更好的选择)向用户必须单击的按钮添加onclick
处理程序(因为当用户通过按下Esc
关闭模式时,也会触发hidden.bs.modal
事件)或单击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.