原文链接:http://blog.csdn.net/cyh1111/article/details/52960747

背景

使用Bootstrap Modal实现用户资料修改,由于用户信息过多,默认Modal出现页面滚动条,为了用户体验,不使用页面滚动条,在Modal body部分加垂直滚动条,Modal header和footer固定位置。

效果

 

代码

加入CSS样式

.modal-dialog {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
} .modal-content {
/*overflow-y: scroll; */
position: absolute;
top: 0;
bottom: 0;
width: 100%;
} .modal-body {
overflow-y: scroll;
position: absolute;
top: 55px;
bottom: 65px;
width: 100%;
} .modal-header .close {margin-right: 15px;} .modal-footer {
position: absolute;
width: 100%;
bottom: 0;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

Modal 代码

<!-- EditUser -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" >
<div class="modal-content"> <div class="modal-header" style="font-weight: bold;">
<button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span><span class="sr-only"><sp:message code="sys.close" /></span>
</button>
<h4 class="modal-title" id="myModalLabel"><sp:message code="user.info"/>-<sp:message code="sys.edit"/></h4>
</div> <div class="modal-body" >
<form class="form-horizontal" id="editForm" action="<%=path%>/com/update" method="post">
<div class="form-group">
<label for="inputName" class="col-sm-3 control-label"><sp:message code="user.username"/></label>
<div class="col-sm-9">
<input type="text" class="form-control input-sm" name="username" readonly="readonly">
</div>
</div>
...其他代码省略
</form>
</div>
<!-- modal-body END --> <div class="modal-footer">
<button id="btn-submit" type="submit" class="btn btn-primary"><sp:message code="sys.submit"/></button>
</div>
</div>
</div>
</div>

Bootstrap Modal 垂直方向加滚动条的更多相关文章

  1. Bootstrap Modal 关闭时右侧滚动条消失,页面左移的解决方法

    问题描述:页面在打开Modal之前右侧有滚动条,Modal关闭之后,body中的class="modal-open"和style="padding-right: 17px ...

  2. 关于bootstrap modal 垂直滚动条 每次打开后不置顶的问题

    打开modal时,滚动条默认没有置顶. 查了很久,网上找了很多资料都没有解决. 经分析是需要在modal的消失事件中添加让滚动条置顶的方法.

  3. bootstrap modal 监听滚动条事件

    bootstrap modal 里面使用datetimepicker时间控件,滚动时,时间控件并不会隐藏,这是一个小bug,在组里改下,当滚动条滚动时,直接隐藏这个时间控件,$("#alar ...

  4. 在bootstrap modal 中加载百度地图的信息窗口失效解决方法

    这个问题其实很傻,解决方法没有任何技术含量,只是记录下工作中发生的事. 前阵子给一个汽车集团客户做了一个经销商查询系统,其中一个功能是使用地图标注经销商店面地址,并且实现导航功能. 页面演示地址:ht ...

  5. 怎么给tbody加滚动条?通过css样式给表格tbody加垂直滚动条

    tbody加滚动条实现思路: 1,把tbody设置成display:block,然后就对其高度设置一个固定值,overflow设置成auto. 2,把thead的tr设置成display:block. ...

  6. ProgressBar显示进度值,垂直或者水平滚动条

    过去一段时间,在研究Windows的系统控件ProgressBar,一直奇怪为啥它不能显示进度值,本以为是个很简单的问题,结果搜索很久,也没有找到好的解决方案,最后终于找到一个Perfect方案,特记 ...

  7. 《在纹线方向上进行平滑滤波,在纹线的垂直方向上进行锐化滤波》 --Gabor增强的具体实践

    <在纹线方向上进行平滑滤波,在纹线的垂直方向上进行锐化滤波>                                          --Gabor增强的具体实践     一.问 ...

  8. Bootstrap modal垂直居中

    Bootstrap modal垂直居中   在网上看到有Bootstrap2的Modal dialog垂直居中问题解决方法,这种方法自己试了一下,并不能完全居中,并且窗口的大小不一样的话,每次显示的m ...

  9. 对bootstrap modal的简单扩展封装

    对bootstrap modal的简单扩展封装 参考自:http://www.muzilei.com/archives/677   注:原文不支持bootstrap新版本,并且居中等存在问题 此段时间 ...

随机推荐

  1. 给Source Insight做个外挂系列之六--“TabSiPlus”的其它问题

    关于如何做一个Source Insight外挂插件的全过程都已经写完了,这么一点东西拖了一年的时间才写完,足以说明我是一个很懒的人,如果不是很多朋友的关心和督促,恐怕是难以完成了.许多朋友希望顺着本文 ...

  2. 使用Qt5.7.0 VS2015版本生成兼容XP的可执行程序 good(从VS2012 update1开始支持xp和c++11)

    一.直接使用VS2012/VS2013/VS2015生成XP兼容的可执行程序 Visual Studio刚发布时没打补丁,称为RTM版,之后会陆续发布补丁,进行bug修复和功能增强.VS2010及之前 ...

  3. C# 日期格式转【转】

    使用:DateTime.ToString的方法(String, IFormatProvider)转换格式 using System; using System.Globalization; Strin ...

  4. .net DropDownList静态联动

    1.前台 <span id="spnClient" style="margin-left: 30px; margin-top: 10px"> < ...

  5. sqlserver锁表、解锁、查看销表 (转载)

    sqlserver中怎么锁表.解锁.查看销表呢,下面我以三个不同的实例给各位朋友详细介绍一下有需要的朋友可参考一下. 更多详细内容请查看:http://www.111cn.net/database/O ...

  6. Autorelease自动释放池的使用

    Autorelease自动释放池的使用 使用ARC开发,只是在编译时,编译器会根据代码结构自动添加了retain.release和autorelease. MRC内存管理原则:谁申请,谁释放 遇到al ...

  7. Python之路----------time模块

    时间模块是常用的模块 一.time模块 import time print(time.clock())#返回处理器时间,3.3开始已经屏蔽. print(time.altzone)#返回与UTC时间差 ...

  8. jquery选择器和基本语句

    $("#aa"); //根据ID找 $(".aa"); //根据class找 $("div"); //根据标签名找 $("[id= ...

  9. jQuery 跨域访问的三种方式 No 'Access-Control-Allow-Origin' header is present on the reque

    问题: XMLHttpRequest cannot load http://v.xxx.com. No 'Access-Control-Allow-Origin' header is present ...

  10. Sublime Text3 以及 SublimeREPL使用Virtualenv执行python

    1. SublimeText3 安装Virtualenv插件(Crtl+Shift+P) 2. 新建python虚拟环境: Crtl+Shift+P,选中Virtualenv:New选项,在底部Vir ...