html - 在到达顶部之前滚动元素
问题描述
我正在一个带有固定导航栏的网站上工作。导航栏具有透明背景,位于整个页面的背景图像前面。
问题是我希望以下元素在导航栏下方消失。但相反,它们在透明导航栏后面滚动。
我还没有发现要在 div#scrollwrapper 中设置以下内容以在顶部滚动:124px。而是在透明导航后面滚动。
HTML
<html>
<body>
<div id="wrapper">
<nav></nav>
<div id="scrollwrapper"></div>
</div>
<footer></footer>
</body>
</html>
CSS
#wrapper{
min-height:100%;
position: relative;
display: block;
}
#wrapper:after{
background-image: url(../img/bg.jpg);
background-color: #0b0d89;
background-size: cover;
background-position: center;
background-repeat: no-repeat;
background-attachment: fixed;
content: "";
opacity: 1;
top: 0;
left: 0;
bottom: 0;
right: 0;
position: absolute;
z-index: -1;
}
.navbar {
background-color:
rgba(11, 13, 137, 0.5600000000000001);
max-width: 1140px;
margin: 0 auto;
position: sticky;
top: 0;
z-index: 1020;
}
解决方案
推荐阅读
- javascript - 隐藏 div 后允许在按钮单击时重新显示
- python - 分离背景图像
- sql - 获取对应行中具有变量的列的名称
- c++ - CMake 错误 - 找不到 CMAKE_C_COMPILER。对于特定项目
- ios - 放置在白色背景上时,UIVisualEffectView“消失”
- python - 在应用程序之间切换 - pywinauto
- ios - IOS/Objective-C:使用 StringByReplacingOccurenceOfString 的大小写不敏感搜索
- visual-studio-2017 - Visual Studio 2017 按文件类型和字母顺序排序解决方案资源管理器
- .net - .NET Webhook 发件人
- javascript - 在javascript中的函数之间传递变量