无法单击附件固定背景上的位置固定按钮
cannot click position fixed button on attachment fixed background
这是正在发生的事情:
我有一个位置固定值的菜单按钮,在我的页面上我有一个 div 和一个固定的背景附件。
当我向下滚动时,它一切正常,直到我尝试在它进入固定背景时单击按钮,但它没有单击
.page {
width: 100%;
transition: 0.5s;
height: 1900px;
}
/*backgroun image*/
.unscrollable {
background-color: grey;
width: 100%;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
opacity: 0.8;
}
.page div.content {
width: 80%;
padding-left: 10%;
padding-right: 10%;
}
<div style="width:80%">
<button style="position:fixed;cursor:pointer; top: 0">click</button>
</div>
<div class="page" id="page">
<div class="unscrollable" style="min-height:105%;"></div>
</div>
有谁知道如何让我的按钮再次起作用?提前致谢。
另外,如果您知道一种方法可以阻止不透明度应用于按钮!
编辑:感谢@Huangism 的帮助!
将按钮的 z-index 更改为更高级别,而不是它会起作用。
这是正在发生的事情:
我有一个位置固定值的菜单按钮,在我的页面上我有一个 div 和一个固定的背景附件。
当我向下滚动时,它一切正常,直到我尝试在它进入固定背景时单击按钮,但它没有单击
.page {
width: 100%;
transition: 0.5s;
height: 1900px;
}
/*backgroun image*/
.unscrollable {
background-color: grey;
width: 100%;
background-attachment: fixed;
background-repeat: no-repeat;
background-size: cover;
opacity: 0.8;
}
.page div.content {
width: 80%;
padding-left: 10%;
padding-right: 10%;
}
<div style="width:80%">
<button style="position:fixed;cursor:pointer; top: 0">click</button>
</div>
<div class="page" id="page">
<div class="unscrollable" style="min-height:105%;"></div>
</div>
有谁知道如何让我的按钮再次起作用?提前致谢。
另外,如果您知道一种方法可以阻止不透明度应用于按钮!
编辑:感谢@Huangism 的帮助!
将按钮的 z-index 更改为更高级别,而不是它会起作用。