如何使元素对点击透明,但仍然可见? [英] How to make an element transparent to clicks but still visible?
问题描述
我有兴趣在像iframe这样的东西上加入一个插入盒阴影。虽然在iframe上重叠div的策略给出了预期的可视显示,但div随后会阻止iframe本身的点击。
I'm interested in putting an inset box shadow on something like an iframe. While the strategy of overlaying a div over the iframe gives the expected visual display, the div subsequently blocks clicks on the iframe itself.
因此,有一种方法可以拉出插图阴影作为框架效果?
So is there a way to pull off the inset shadow as a "framing" effect?
推荐答案
是的,有 pointer-events:none
。
请参阅: http://jsfiddle.net/YqXPg/3/
使重叠式广告更加明显的版本: http://jsfiddle.net/YqXPg/4/
A version that makes the overlay more obvious: http://jsfiddle.net/YqXPg/4/
请注意,此属性不适用于IE,但如果我记得正确,IE将允许您点击覆盖的透明部分 div
。
Note that this property doesn't work with IE, but if I remember correctly, IE will allow you to click through the transparent parts of the overlay div
anyway.
这篇关于如何使元素对点击透明,但仍然可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!