html - 在 Bootstrap 3.0 Modal 中,禁用滚动条但它仍然占用空间

标签 html css twitter-bootstrap scrollbar

这个问题与此有关:-

Why does a second vertical scroll bar appear in this Bootstrap 3.0 Modal demo?

好的。我已经覆盖了 .modaloverflow-y 规则:-

.modal {
    overflow-y: auto !important;
}

但是现在当模式打开时我看不到滚动条。没关系。这就是我所需要的。但是,它仍然会占用空间,并且每当模式打开时页面都会向左移动。

截图:-

enter image description here

有什么解决办法吗?

最佳答案

罪魁祸首落网。 Bootstrap 使用以下名称和规则向主体和其他区域添加一个类:-

body.modal-open, .modal-open .navbar-fixed-top, .modal-open .navbar-fixed-bottom {
     margin-right:15px;
}

也重写这个类如下,就可以了。

body.modal-open, .modal-open .navbar-fixed-top, .modal-open .navbar-fixed-bottom {
     margin-right:0px;
}

关于html - 在 Bootstrap 3.0 Modal 中,禁用滚动条但它仍然占用空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18944234/

相关文章:

html - 水平和垂直居中表格单元格的内容?

jquery - 使用 Jquery 在单击其他复选框时启用复选框

javascript - 当用户滚动时,我希望 div 在页面底部滚动

JQuery - 结束日期小于开始日期

css - Bootstrap 3.3.7 更改导航栏中折叠堆栈的悬停/事件颜色?

javascript - 带分数的 Vue.JS 测验 - 2 个答案有效,3 个答案无效

javascript - 如何在 html 和 javascript 中使用 dataTable 和 getelementbyid ?

html - 为什么我无法将高度和宽度应用于我的 SVG 路径元素?

html - 两个产品表有什么区别

css - 创建 Bootstrap 响应式布局时如何设置容器 div 的宽度?