2017-03-08 111 views
0

我有这两个div:父div #filterSelect,包含一组过滤器,它的子div #applyFilterIKnow即“应用过滤器”按钮。 #applyFilterIKnow应该始终可见并固定在#filterSelect div的底部。问题是#applyFilterIKnow#filterSelect一起滚动。这里的两个CSS:Sass/CSS:停止固定div随父母div一起滚动

#filterSelect { 
    transform: translateX(100%); 
    transition: transform 0.3s; 
    overflow-x: auto; 
    overflow-y: auto; 
    width: 15%; 
    position: absolute; 
    z-index: 1000; 
    right: 0; 
    height: 100%; 
} 

#applyFilterIKnow { 
    position: fixed; 
    width: 100%; 
    height: 50px; 
    bottom: 0; 
    right: 0; 
    background-color: #4370d9; 
    transition: all 0.5s ease; 
    font-size: 2rem; 
    padding-top: 10px; 
    text-align: center; 
    color: white; 
    cursor: pointer; 
} 

我省略了一些相对于背景颜色的CSS。假设其中一个解决方案是将#filterSelect的位置设置为相对位置,但这会使整个div与页面内容的其余部分重叠。我能做什么?在此先感谢任何人响应我的疑问:(

下面是相关问题的一些截图:

enter image description here enter image description here

回答

0

的问题是,你的父母也绝对绝对(或固定)当他们被托管在绝对定位的父元素中时,它们的行为会有所不同:它们仍然遵循父母的约束。

唯一可能的方式(我知道)是将您的固定元素移动到其父元素之外

+0

感谢您的回答!我会看看我能否做到这一点,因为这已经建立,也许我将不得不改变os js:s –