css - Angularstrap Modal 隐藏垂直浏览器滚动条

标签 css angularjs angular-strap

我正在测试 Angular 带的模态窗口,但发生了一些不希望发生的事情。在大文档中,当模式可见时,浏览器滚动条消失。然后,当您关闭模式时,浏览器滚动条再次显示并且文档折叠了一下。

我看了一个小时的开发者工具,但找不到原因。

文档折叠时很烦人。

如何防止滚动条不可见?

HTML

<button data-animation="am-fade-and-scale" bs-modal="modal">
  Open Modal
</button>

Controller

var app = angular.module('Test', ['ngAnimate', 'mgcrea.ngStrap']);

app.controller('ModalCtrl', 
  function($scope){
    $scope.modal = {
      "title" : "ModalTitle",
      "content" : "Modal content"
    };
})

http://plnkr.co/edit/yKZSnn?p=preview

已在 Windows 8.1 上测试

      Chrome 36, Firefox 31, Opera 24 - Same results.
      Safari 5.1.7 - Worst results, the overlayer still visible.

最佳答案

对于模态,溢出设置为隐藏。

可以设置body的overflow为auto来解决这个问题。

<body ng-controller="ModalCtrl" style="overflow: auto">

工作演示 http://plnkr.co/edit/DGb38NBp89Fl4Jhvvyx3?p=preview

关于css - Angularstrap Modal 隐藏垂直浏览器滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25883243/

相关文章:

javascript - 使用 jquery 获取 div 高度的问题

html - 当@media screen and (max-width : 360px) it should be at center

javascript - 为什么引导面板切换在 reactjs 构建版本中不起作用?

javascript - 过滤器不适用于 AngularStrap bs-select 和 ng-options

angularjs - AngularStrap bs-select 不更新 ng-model

html - <div> float : left not going left

javascript - AngularJS指令对象有 "No Method"

javascript - Angular 无法读取数组中的对象

javascript - 如何在 AngularJS 中观察数组的变化

javascript - 当select只有一项时如何禁用select的下拉菜单