jquery - Bootstrap modal-body – 禁止使用 ESC 键或鼠标关闭

标签 jquery css twitter-bootstrap

如何禁用模态主体关闭,请注意我不能使用模态类或模态淡入淡出。 我正在起诉两个页面,一个页面有一个 href,然后单击转到另一个页面有模态:

<td align='center'  span style="font-weight:bold;"><a href="save_new.php</a></td>

所以这是我的代码

    <link rel="stylesheet" href="css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){

$('#myModal').modal({
backdrop: 'static'
    });
});
</script>
<div id="myModal" class="modal-body">
<button  class = "btn btn-success" ><span class = "glyphicon glyphicon-ok"></span> Done</button>
</div>                              

最佳答案

作为 Javascript:

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

作为 HTML:

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

关于jquery - Bootstrap modal-body – 禁止使用 ESC 键或鼠标关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41966854/

相关文章:

javascript - 如何在 javascript 或 jquery 中向字符串添加一些数字

html - 表单在规模上变得无响应

html - IE8 样式背景 URL 图像

ruby-on-rails - 如何在 Rails 代码中链接社交媒体图片

javascript - 使用 jQuery 在请求 header 中设置中文字符

jquery - Ajax 文件上传在 IE7 中不起作用

javascript - 如何使用 C# 隐藏面板?

html - 侧边栏在所有页面上的显示都不一样

html - td元素的Bootstrap边框与colspan的问题

html - "aria-describedby"和 "aria-hidden"属性如何在 Bootstrap 中工作?