【发布时间】:2018-04-19 10:23:01
【问题描述】:
我在移动设备上的粘性 div 有问题。我想在移动菜单中获得粘性窗口 div 效果。所以,黄色的 div 应该覆盖菜单的一部分。我尝试了使用绝对位置和修复的不同解决方案,不幸的是我不想按照自己的方式行事。 My website
粘性 div:
<div class="tag-wrapper">
<div class="tag">Click here to Refresh</div>
</div>
CSS:
.tag-wrapper {
position: absolute;
top: 0px;
left: 80px;
}
.tag {
position: fixed;
background: #ffcc33;
border: 2px solid #dfa800;
border-top: 0px;
padding: 3px 5px;
bottom: 0;
}
CSS 我的导航栏:
.side-nav {
position: fixed;
width: 260px;
left: 0;
top: 0;
margin: 0;
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
height: 100%;
height: -webkit-calc(100%+ 60px);
height: calc(100%+ 60px);
height: -moz-calc(100%);
padding-bottom: 60px;
color: #d8d8d8;
background-color: #23282e;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
z-index: 1040;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
overflow: hidden;
will-change: transform;
backface-visibility: hidden;
-webkit-transform: translateX(-105%);
-ms-transform: translateX(-105%);
transform: translateX(-105%);
list-style-type: none;
padding: 0;
overflow-x: hidden;
overflow-y: scroll;}
打开手机外观后,我想要得到的效果是on this page。菜单位于粘性 div 下。 Screen
【问题讨论】:
-
在那个黄色的 div 中详细解释 粘滞窗口 div 效果,以便我们为您提供帮助。还要添加您希望我们检查的代码部分
-
当然,我更正了我的描述
标签: html css scroll window sticky