Bootstrap模态框
backdrop选项,当设置成false的时候, 背景不会出现半透明的遮盖层,当用户点击模态框外部时不会关闭模态框; 设置成true的时候会出现遮盖层,当用户点击模态框外部时则会关闭模态框。
那如果又想有这个遮盖的效果,但是又不想用户点击模态框外部时关闭模态框,该怎么弄能?其实这个遮盖层就是加了一个DIV. (<div class="modal-backdrop in"></div>)
我们可以把backdrop设置成false,然后直接加上这个DIV就可以了。
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap 实例 - 模态框(Modal)插件事件</title>
<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
</head>
<body> <h2>模态框(Modal)插件事件</h2> <!-- 按钮触发模态框 -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
开始演示模态框
</button> <!-- 模态框(Modal) -->
<div class="modal" id="myModal" tabindex="-1" role="dialog" data-backdrop="false" data-keyboard="false" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-backdrop in"></div>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
点击关闭按钮检查事件功能。
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
关闭
</button>
<button type="button" class="btn btn-primary">
提交更改
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
$(function () { $('#myModal').modal('hide')})});
</script> </body>
</html>
Bootstrap模态框的更多相关文章
- js控制Bootstrap 模态框(Modal)插件
js控制Bootstrap 模态框(Modal)插件 http://www.cnblogs.com/zzjeny/p/5564400.html
- Bootstrap模态框按钮
1.触发模态框弹窗的代码 这里复制了一段Bootstrap模态框的代码 <h2>创建模态框(Modal)</h2> <!-- 按钮触发模态框 --> <but ...
- 解决bootstrap模态框内输入框无法获取焦点
bootstrap 模态框中的input标签在某些情况下会无法获取焦点. 最终解决方法:去除模态框的 tabindex="-1" 属性即可
- Bootstrap 模态框(Modal)插件
原文链接:http://www.runoob.com/bootstrap/bootstrap-modal-plugin.html Bootstrap 模态框(Modal)插件 模态框(Modal)是覆 ...
- Bootstrap 模态框在用户点击背景空白处时会自动关闭
问题: Bootstrap 模态框在用户点击背景空白处时,会自动关闭. 解决方法: 在HTML页面中编写模态框时,在div初始化时添加属性 aria-hidden=”true” data-backdr ...
- Bootstrap模态框(MVC)
BZ这篇博客主要是为大家介绍一下MVC如何弹出模态框.本文如果有什么不对的地方,希望大神们多多指教,也希望和我一样的小菜多多学习.BZ在这里谢过各位. 首先要在页面加上一个点击事件: @Html.Ac ...
- 去除bootstrap模态框半透明阴影
当使用bootstrap模态框默认自带半透明阴影,如果想要去除阴影,需要怎么做呢? 今天在项目中我遇到了这个问题,想要去除模态框的阴影,试了好久都没解决.后来问同事的时候才知道,当模态框弹出后,会加上 ...
- Bootstrap 模态框 + iframe > 打开子页面 > 数据传输/关闭模态框
父页面bootstrap模态框: <div class="modal fade" id="myModal" tabindex="-1" ...
- bootstrap模态框modal使用remote第二次加载显示相同内容解决办法
bootstrap模态框modal使用remote动态加载内容,第二次加载显示相同内容解决办法 bootstrap的modal中,使用remote可以动态加载页面到modal-body中,并弹窗显示 ...
- BootStrap 模态框基本用法
<!DOCTYPE html> <html> <head> <title>Bootstrap 实例 - 模态框(Modal)插件方法</title ...
随机推荐
- 7. Android框架和工具之 android-percent-support-lib-sample(百分比支持)
1. android-percent-support-lib-sample介绍: 谷歌最新的百分比布局库的示例项目.其实LinearLayout的layout_weight也能实现百分比效果,不过这个 ...
- uva 10252 - Common Permutation 字符串水题
题意:給定兩個小寫的字串a與b,請印出皆出現在兩字串中的字母,出現的字母由a~z的順序印出,若同字母出現不只一次,請重複印出但不能超過任一字串中出現的次數.(from Ruby兔) 很水,直接比较输出 ...
- (转)JavaScript 中对变量和函数声明的“提前(hoist)”
变量声明“被提前” JavaScript 的语法和 C .Java.C# 类似,统称为 C 类语法.有过 C 或 Java 编程经验的同学应该对“先声明.后使用”的规则很熟悉,如果使用未经声明的变量或 ...
- linux安装mysql出现Could NOT find Curses (missing CURSES_LIBRARY CURSES_INCLUDE_PATH)解决方法
编译 mysql5.6.22 出现以下错误提示: — Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMak ...
- gcc: error trying to exec 'cc1plus': execvp: no such file or directory
最近在安装OpenCV cmake的时,出现gcc: error trying to exec 'cc1plus': execvp: no such file or directory的错误. 导致问 ...
- a different object with the same identifier value was already associated withthe session异常解决方案
异常信息: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was ...
- 剑指Offer29 连续子数组最大和
/************************************************************************* > File Name: 29_Greate ...
- weimi 短信API post方式的简易代码。
http://www.weimi.cc/example-csharp.html string mobile = "<enter your mobiles>", con ...
- android chrome 不支持 audio/video的autoplay 属性
在chrome 浏览器中输入:chrome://flags,找到"播放媒体时的手势要求",停用就可以了.
- Javascript计算中英文混输字符串长度V2
同上篇, client端也需要同样规则验证 compact_strlen: function(str) { var strlen = 0; for(var i =0; i<str.length; ...