[英]Make click go through an element to one behind it
I have a div that spans my entire page with some buttons.我有一个 div,它用一些按钮跨越我的整个页面。 The div however, is transparent.
然而,div 是透明的。 I have placed a video behind the div, that I would like to be able to start and stop.
我在 div 后面放了一个视频,我希望能够开始和停止。 Of course, only when I press somewhere that isn't a button.
当然,只有当我按下不是按钮的地方时。 But currently, the div is consuming the click.
但目前,div 正在消耗点击。 I would like the click to propagate to the element behind it.
我希望点击传播到它后面的元素。 However, I would still like it to block swipes.
但是,我仍然希望它阻止滑动。
CSS CSS
.root {
display: grid;
grid-template-columns: 0.7fr 1fr 0.7fr;
grid-template-rows: 1fr;
gap: 0px 0px;
grid-template-areas: "left center right";
height: 100vh;
width: 100vw;
position: absolute;
}
HTML HTML
<div
className="root"
style={{
display: "grid"
width: `calc(100% - ${arg1? arg3: 0}px)`,
height: `calc(100% - ${arg2 ? arg4: 0}px)`,
backgroundColor: "#ffffff00",
}}
onClick={(ev) => {
console.log("cl");
}}
>
You need the pointer-events: none;
您需要
pointer-events: none;
css property. css 属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.