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

查看:32
本文介绍了禁止关闭 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天全站免登陆