Html 单击更高 z-index div 下面的链接
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6740242/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
click link below a higher z-index div
提问by Eric Fortis
Possible Duplicate:
Passing mouse clicks through an overlaying element <div>
可能的重复:
通过覆盖元素 <div> 传递鼠标点击
Is it possible to click the link below the red square without javascript? The red div doesn't need to be clickable.
是否可以在没有 javascript 的情况下单击红色方块下方的链接?红色 div 不需要可点击。
http://jsfiddle.net/efortis/LNwHV/
http://jsfiddle.net/efortis/LNwHV/
#bottom{
width: 100px;
height: 100px;
background-color: orange;
}
#top{
width: 50px;
height: 50px;
position: absolute;
left:0;
top:0;
background-color: rgba(255,0,0,.5);
}
回答by thirtydot
The CSS method to do this is pointer-events: none
执行此操作的 CSS 方法是 pointer-events: none
See:http://jsfiddle.net/LNwHV/1/
见:http : //jsfiddle.net/LNwHV/1/
Browser support: http://caniuse.com/pointer-events(works everywhere except IE10 and older)
浏览器支持:http: //caniuse.com/pointer-events(适用于除 IE10 及更早版本以外的所有地方)
To support old versions of IE, you'll have to use JavaScriptas a fallback.
要支持旧版本的 IE,您必须使用 JavaScript作为后备。