[英]Interact with elements behind a div
我有2個div(div1,div2)。 div1在前面,div2在后面。 我想使用div1制作用於更改顏色模式的遮罩(更改所有站點的顏色調節器)。 因此div1必須站在最高位置(z-index = 999999)。 但是,在這種情況下,我無法與div1之后的其他元素進行交互。 我能怎么做?
#div1{ position:fixed; width:100%; height:100%; top:0px; left:0px; background-color:rgba(255, 255, 0, 0.2); z-index:99999; } #div2{}
<div id="div1"></div> <div id="div2"> <input type='button' value="click me"> </div>
您可以使用pointer-events:none
https://caniuse.com/#search=pointer-events
#div1{ position:fixed; width:100%; height:100%; top:0px; left:0px; background-color:rgba(255, 255, 0, 0.2); z-index:99999; pointer-events: none; } #div2{}
<div id="div1"></div> <div id="div2"> <input type='button' value="click me"> </div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.