原文链接: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. 用onerror处理图片获取失败问题

    <script> function errorImg(){ //当前事件的源 var obj=event.srcElement; //需要修改的图片的url obj.src="h ...

  2. ECharts饼图试玩

    处理类似提交问卷的数据,要生成图表,用了ECharts,好方便的. 简陋效果: 1.表单存储 有单选和多选题,单选直接存储各选项数字值,1,2,3,4...中一个:多选用|分隔存储选项值,如1|3,2 ...

  3. vim - char code and charset

    In normal mode, type ga to display the decimal and hex values for the character under the cursor, or ...

  4. Windows Server 2008 R2 域控DOS命令

    net user                                                         #查看本地用户 net  localgroup             ...

  5. ios移动端部分手机不支持background-attachment: fixed 的解决办法

    ios系统和某些移动端background-attachment:fixed不兼容性,没有任何效果,但可以hack一下就可以了,代码如下: ps:想在哪个标签加背景,可以在它class后:before ...

  6. HBA相关知识

    HBA使用详解: 一般的AIX客户端支持的HBA为Emulex HBA卡和交换机硬件确保连接成功的标志: A. 如果是 Emulex卡,卡上的绿灯常亮,黄灯闪烁. B. 如果是 QLogic卡,卡上的 ...

  7. c语言第11次作业

    #include<stdio.h> void sum(int *p,int n) { ]; ; int i; ;i<n;++i) { sum+=*p+a[i]; } } int ma ...

  8. 返回值是TEXT的阿贾克斯方法

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  9. windows 下编辑shell,到linux报错,也是windows换行等造成

    sed -i 's/\r$//' shell.sh 然后linux 下就不会报语法错误了.

  10. AS配置IDE

    字体调整 settings->editor->colors&fonts->font,必须save as一个名称,个人选择Courier New字体,大小为14: 快捷键设置 ...