简体   繁体   English

在部分透明图像上单击透明区域

[英]Click through transparent area on partially transparent image

Given some shape, I would like it to be clickable on its filled parts, and not clickable (thus clicking through to the element behind it) on its transparent parts. 给定一些形状,我希望它可以在其填充的部分上点击,而不是在其透明部分上可点击(因此点击它后面的元素)。 Here's an example of a triangle shape: http://img138.imageshack.us/img138/1276/e4t.png 这是一个三角形的例子: http//img138.imageshack.us/img138/1276/e4t.png

Black lines are bounding box lines. 黑线是边框线。 I would like to be able to select text, or interact with any element that is within bounding box (green-outlined areas), but not covered with the filled part. 我希望能够选择文本,或与边界框内的任何元素(绿色轮廓区域)进行交互,但不会被填充的部分覆盖。

I tried SVG with pointer-events set to every possible value, but it does not seem to work. 我尝试了SVG,指针事件设置为每个可能的值,但它似乎不起作用。 Preferred solution would make us of html5, css and png image, but every working solution is welcomed. 首选解决方案将使我们成为html5,css和png图像,但欢迎每个工作解决方案。

You can add style property 您可以添加样式属性

pointer-event:none 指针事件:无

to Image it will help you out through the image 到图像它会帮助你通过图像

Note: it will work only to modern browsers 注意:它仅适用于现代浏览器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM