当鼠标悬停在应用了position:fixed
属性的子元素上时,我无法滚动父容器。当鼠标位于固定位置的子元素上方时,它会停止滚动父元素。
以下是我的代码。当鼠标在红色
上方时,我需要滚动黄色
:
我尝试过几种技术,比如使用
有什么帮助吗?
.parent{
position:absolute;
top:0;
bottom:0;
left:0;
right:0;
overflow:hidden;
padding:20px;
background-color:aqua;
}
.fixed {
position:fixed;
top:30px;
height:50px;
width:50px;
background-color:red;
}
.arrow{
height:50px;
width:50px;
background-color:yellow;
}
.child{
height:100%;
width:100%;
box-sizing:border-box;
overflow-y:scroll;
padding:10px;
background-color:pink;
}
.child-2{
height:1000px;
width:100%;
box-sizing:border-box;
background-color:yellow;
}
<div class="parent">
<div class="child">
<div class="child-2">
<div class="fixed">
</div>
</div>
</div>
</div>
pointer-events:none
或通过js滚动元素,但这些方法在我的用例中都不起作用,因为我需要在元素上注册事件。有什么帮助吗?