禁止关闭Twitter Bootstrap模态窗口 [英] Disallow Twitter Bootstrap modal window from closing

查看:102
本文介绍了禁止关闭Twitter Bootstrap模态窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter Bootstrap创建模式窗口.默认行为是,如果您在模态区域之外单击,模态将自动关闭.我想禁用该功能-也就是说,在模态外部单击时,请不要关闭模态窗口.

I am creating a modal window using Twitter Bootstrap. The default behavior is if you click outside the modal area, the modal will automatically close. I would like to disable that -- i.e. not close the modal window when clicking outside the modal.

有人可以共享jQuery代码来做到这一点吗?

Can someone share jQuery code to do this?

推荐答案

我相信您要将背景值设置为静态.如果要避免在使用 Esc 键时关闭窗口,则必须设置另一个值.

I believe you want to set the backdrop value to static. If you want to avoid the window to close when using the Esc key, you have to set another value.

示例:

<a data-controls-modal="your_div_id"
   data-backdrop="static"
   data-keyboard="false"
   href="#">

或者,如果您使用的是JavaScript:

OR if you are using JavaScript:

$('#myModal').modal({
  backdrop: 'static',
  keyboard: false
});

这篇关于禁止关闭Twitter Bootstrap模态窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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