Open URL on Bootstrap Modal close

帅比萌擦擦* 提交于 2019-12-03 14:27:46

Along the lines of @Knagis additional option, you can use onclick to change the window.location, and the data-dismiss=modal attribute in the same link..

<a href="" data-dismiss="modal" onclick="javascript:window.location='http://google.com'">Visit Google.</a>

Demo: http://www.bootply.com/oKgjTJXGTq

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

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

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.

it also dismiss the modal , modal should be dismissed after 10-20 seconds or manualy by closing it , is it possible .

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!