BootStrap模态框垂直居中方法
来源:互联网 发布:js 鼠标的位置 编辑:程序博客网 时间:2024/05/22 07:59
解决问题:BootStrap自带的模态框不垂直居中
解决方案:调用BootStrap为我们提供的方法$('.modal').on('show.bs.modal', function(){});
在模态框显示之前我们用JS修改他的Top值,
具体代码如下:
/** * 垂直居中模态框 **/function centerModals() {$('.modal').each(function(i) {var $clone = $(this).clone().css('display', 'block').appendTo('body');var top = Math.round(($clone.height() - $clone.find('.modal-content').height()) / 2);top = top > 50 ? top : 0;$clone.remove();$(this).find('.modal-content').css("margin-top", top - 50);});}// 在模态框出现的时候调用垂直居中方法$('.modal').on('show.bs.modal', centerModals);// 在窗口大小改变的时候调用垂直居中方法$(window).on('resize', centerModals);
阅读全文
0 0
- BootStrap模态框垂直居中方法
- Bootstrap 模态框垂直居中
- bootstrap模态框 垂直居中
- Bootstrap模态框(modal)垂直居中
- Bootstrap模态框(modal)垂直居中
- Bootstrap modal 模态框垂直居中
- bootstrap模态框(modal)垂直居中
- bootstrap模态框垂直居中效果
- Bootstrap模态框水平垂直居中
- Bootstrap 模态框垂直居中处理
- bootstrap模态框的页面垂直居中有效方法整理
- bootstrap modal垂直居中
- bootstrap modal 垂直居中
- bootstrap modal垂直居中
- bootstrap 模态框(modal)实现水平垂直居中显示的方法
- bootstrap modal 垂直居中对齐
- bootstrap modal 垂直居中对齐
- bootstrap modal 垂直居中对齐
- linux shell shift
- mysql 的my.ini文件
- QT:如何获取鼠标坐标点和键盘响应事件
- Android APP第三方授权登陆,分享等功能合集
- Qt4.8.5移植到嵌入式linux(arm平台)
- BootStrap模态框垂直居中方法
- canvas
- 「Git」合并多个 Commit
- HDU 5790 Prefix(字典树、主席树)
- centos6.4 防火墙管理
- 权限管理命令umask
- 服务端接口测试小结
- c
- 测试面试