jquery - 为什么我的覆盖层无法覆盖 Bootstrap 导航栏?

标签 jquery html css angularjs twitter-bootstrap

我正在尝试在我的元素中添加覆盖,以保护用户在内容完全下载之前不会进行大量交互。这就是为什么我添加了覆盖层,如下所示:

.overlay {
  opacity: 0.5; 
  background: #000; 
  width: 100%;
  height: 100%; 
  z-index: 10;
  top: 0; 
  left: 0; 
  position: fixed; 
}

但问题是覆盖层可以覆盖除 Bootstrap 导航栏之外的整个页面的 100%。请帮助我如何覆盖 Bootstrap 导航栏上的覆盖层。

<div class="overlayIndex"></div>
<div class="navbar navbar-default navbar-static-top navbar-fixed-top">
  <div class="container">
    <div class="row">.......</div>
  </div>
</div>
<div ng-view="" autoscroll="true"></div>

enter image description here

最佳答案

将您的 z-index 设置为 1031。Bootstrap 的 navbar-fixed-top 使用的 z-index 为 1030。将其设置为高于此值应该允许您的叠加层覆盖整个视口(viewport)。

navbar-fixed-top 类的 Bootstrap CSS:

.navbar-fixed-top {
  position: fixed;
  right: 0;
  left: 0;
  z-index: 1030;
}

关于jquery - 为什么我的覆盖层无法覆盖 Bootstrap 导航栏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46030703/

相关文章:

javascript - 如何在 JavaScript 中为 "number"类型输入添加事件监听器?

html - 如何使 HTML <button> 用 CSS 垂直填充表格单元格?

html - 仅使用 CSS 切换单选输入

javascript - jQuery:如果 LI 选中了单选框,则添加类

jquery - 在 Web 服务器上安装 Node js

html - 编辑 CSS 类的链接状态

html - 内联响应图像

Javascript json数据分组

jquery - Bootstrap Navbar 中的菜单项未清除 Logo

javascript - 在 PHP 中解码 javascript 数组