http://www.ziqiangxuetang.com/bootstrap/bootstrap-modal-plugin.html

方法

下面是一些可与 modal() 一起使用的有用的方法。

方法 描述 实例
Options: .modal(options) 把内容作为模态框激活。接受一个可选的选项对象。
1
2
3
$('#identifier').modal({
keyboard: false
})
Toggle: .modal('toggle') 手动切换模态框。
1
$('#identifier').modal('toggle')
Show: .modal('show') 手动打开模态框。
1
$('#identifier').modal('show')
Hide: .modal('hide') 手动隐藏模态框。
1
$('#identifier').modal('hide')

bootstrap3打开modal后下层网页内容出现右移

1,注意看BS3的modal,有这么一个样式,当打开的时候,会给body加上modal-open,于是y滚动条没了,页面宽度变大,自然元素就右移了,我图省事,直接重写了这个属性为intial解决了

.modal-open {
overflow: hidden;
}
.modal-open{
overflow: inherit ;
}

且在调用

$("#myModal").modal();

后追加

$("body").css('padding-right','0px');

3,因为modal会给body添加的modal-open类,使得overflow属性默认为hidden,导致滚动条消失了。(溢出部分直接hidden了)

解决方法:

覆盖原有属性:

.modal-open {
overflow: initial !important;
}

或 在body上挂上新的类,如下设置:

 
.fix-modal-open {
overflow: initial;
} 4,在一个modal框里点击关闭,打开另一个modal框,设置了上面的也不管用,paddingright又不对了。于是查看bootstrap.js,发现了个地方,修改为0就行了
function init_website(){
$('#g-top-log').click(function(){
$('#g-top-logModal').modal();
});
$('#g-top-reg').click(function(){
$('#g-top-regModal').modal();
});
$('#btnToReg').click(function(){
$('#g-top-logModal').modal('hide');
$('#g-top-regModal').modal();
});
}
下面的函数修改为0,就行了
Modal.prototype.setScrollbar = function () {
var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)
this.originalBodyPad = document.body.style.paddingRight || ''
//if (this.bodyIsOverflowing) this.$body.css('padding-right', bodyPad + this.scrollbarWidth)
if (this.bodyIsOverflowing) this.$body.css('padding-right', 0)
}


bootstrap modal模态框的运用的更多相关文章

  1. 重置 Bootstrap modal 模态框数据

    利用 Bootstrap modal 模态框弹层添加或编辑数据,第二次弹出模态框时总是记住上一次的数据值,stackoverflow 上找到个比较好的方法,就是利用 jQuery 的 clone 方法 ...

  2. 关于【bootstrap modal 模态框弹出瞬间消失的问题】

    前提是你没有重复引入bootstrap.js\bootstrap.min.js和modal.js.一下提供一个小例子. <button class="btnbtn-primary bt ...

  3. Bootstrap modal模态框关闭时,combobox input下拉框仍然保留在页面上

    问题描述: 当点击模态框的关闭按钮时,下拉框中的内容没有消失,而是移动到了页面左上角 分析:这个问题的定位在于是用的哪种模态框,bootstrap和easyui都可以实现模态框,但是两个方法实现的模态 ...

  4. 修改bootstrap modal模态框的宽度

    原文链接:http://blog.csdn.net/wuhawang/article/details/52252912 修改模态框的宽度很简单,修改width属性就可以了 但是要注意的一点是,修改的不 ...

  5. Bootstrap modal 模态框垂直居中显示补丁

    <script> $.fn.modal.Constructor.prototype.adjustDialog1 = function(){ var modalIsOverflowing = ...

  6. 设置bootstrap modal模态框的宽度和宽度

    (1)修改宽度可以通过修改modal中的modal-dialog这个div宽度实现 <div class="modal-dialog" style="width:6 ...

  7. bootstrap Modal 模态框垂直居中

    解决 Modal 垂直居中的问题,上网找了好多博客,有好多说改源码的,这个并没有实践. 但发现另一种解决办法,可以实现,代码如下: function centerModals(){ $('.modal ...

  8. Bootstrap 实例 - 模态框(Modal)插件

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  9. 黄聪:bootstrap中模态框modal在苹果手机上会失效

    bootstrap中模态框在苹果手机上会失效 可将代码修改为<a  data-toggle="modal" data-target="#wrap" hre ...

随机推荐

  1. Confluence 6 连接到一个 LDAP 目录

    https://www.cwiki.us/display/CONFLUENCEWIKI/Connecting+to+an+LDAP+Directory

  2. django的url的name参数的意义

    Templates的链接地址都是根据urlpatterns定义的地址,拼凑成地址字符串,很难看,而且Templates里拼凑成的地址,随着页面的增加而不断增加,一旦在urlpatterns里的某个地址 ...

  3. Oracle11g温习-第十章:存储架构

    2013年4月27日 星期六 10:38 1.oracle 存储架构: 1)  database  ------------tablespace-------------segment(对象) --- ...

  4. 手动安装Silverlight 4 Tools for Visual Studio 2010

    手动安装吧,将Silverlight 4 Tools for Visual Studio 2010.exe改成rar文件,解压缩,按照下面的步骤安装: 1.silverlight_developer. ...

  5. java并发带返回结果的批量任务执行(CompletionService:Executor + BlockingQueue)

    转载:http://www.it165.net/pro/html/201405/14551.html 一般情况下,我们使用Runnable作为基本的任务表示形式,但是Runnable是一种有很大局限的 ...

  6. libxl 的使用,读取时间格式

    最近开发使用到 libxl,用的是3.8.0 破解版. 具体过程: 1.将lib.dll放在exe同目录下,在代码中引用 libxl.lib #pragma comment(lib, ".\ ...

  7. Taffy自动化测试框架Web开发,Python Flask实践详解

    1. 前言 最近为Taffy自动化测试框架写了个页面,主要实现了用例管理.执行,测试报告查看管理.发送邮件及配置等功能.   本页面适用所有基于taffy/nose框架编写的自动化测试脚本,或基于un ...

  8. bzoj1650

    题解: 二分答案 然后贪心 代码: #include<bits/stdc++.h> using namespace std; ; int n,m,l,a[N]; int pd(int x) ...

  9. netstat 问题处理

    MySQL SQL Writing to net Creating sort index StatisticsPreparing

  10. C语言 string::size_type类型

    string::size_type类型 从逻辑上来讲,size()成员函数似乎应该返回整型数值,或如2.2节“建议”中所述的无符号整数.但事实上,size操作返回的是string::size_type ...