如何允许单击具有较高 z-index 的元素后面的元素
我想在整个页面上进行反思。我有一个从白色渐变为透明的透明 png,我希望它填充浏览器并显示在其他所有内容之上,但允许用户单击其后面的所有内容,不能拖动,并在所有浏览器中工作。这可能吗?
I would like to put a reflection over the entire page. I have a transparent png that fades from white to transparent and I would like it to fill the browser and be displayed above everything else but allow the user to click on everything behind it, not be able to be dragged, and work in all browsers. Is this possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
pointer-events: none
,这适用于除 IE10 及更早版本之外的任何地方。包含更多信息的博客文章:
http://robertnyman.com/2010/03/22/css-pointer-events-to-allow-clicks-on-underlying-elements/
You can use
pointer-events: none
, which works everywhere except IE10 and older.A blog post with more information:
http://robertnyman.com/2010/03/22/css-pointer-events-to-allow-clicks-on-underlying-elements/
为什么不将内容背景设置为透明,或者使用透明 png?
或者设置内容的不透明度,就像它淡入背景一样。不确定您想要实现什么,但我确信如果您尝试新方法,您可以获得类似的效果。从设计的角度来看,我无法想象主要内容上的 div 如何能够创造出通过其他方法无法实现的效果。
Why not make the content backgrounds transparent, or with transparent png's?
Or set the opacity for the content as if it's faded into the background. Not sure what you're trying to achieve though I'm sure you can get a similar effect if you try a new approach. From a design point of view I can't imagine how a div over the main content could create an effect not achievable via other methods.