可以通过对CSS样式的修改来解决此问题。为背景菜单叠加层添加“pointer-events: none”,即可将所有鼠标事件都传递到下层元素,这样就可以正常点击主页面上的按钮。
代码示例:
.overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); z-index: 999; pointer-events: none; /* 将 pointer-events 设置为 none */ }
.main-page { position: relative; z-index: 1000; /* 设置 z-index 比叠加层高 / / 其他样式属性 */ }
上一篇:背景不遵循边框半径问题
下一篇:背景彩虹动画为什么不工作?”