English 中文(简体)
我可以用透明矩形元素在 SVG 中以透明矩形元素环绕路径吗? 我要将整个 SVG 图像变成可点击的链接
原标题:Can I wrap paths in SVG with a transparent rectangular element? I want to make an entire SVG image into a clickable link
  • 时间:2012-05-23 16:53:27
  •  标签:
  • svg

我基本上有一个 SVG 标识, 有很多透明空间, 我想将整件事链接到另一页。 如果它是 Alpha PNG, 我只需要将整件事包装在一个 & lt; a> 中, 并且用它来完成, 但是当我将所有的 & lt; paths> 包起来时; 没有透明区域连接起来 。

<svg width="100px" height="52px" enable-background="new 0 0 750.72 391.873">
<a xlink:href="http://www.mysite.com" id="anchor">
  <path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="..."/>
  <path fill-rule="evenodd" clip-rule="evenodd" fill="#FFFFFF" d="..."/>
</a>
</svg>
问题回答

创建不可见的矩形( 可见=“ 隐藏 ” ), 以填充视图端口, 然后在它上设置指针- 活动=“ 全部” 以捕捉所有鼠标点击 。

或者,如果您从 SVG 中取出链接, 使其成为一个独立的文件, 您可以通过 标签将它包含在任何地方, 然后用 标签覆盖 标签 。





相关问题
How to simplify SVG code?

Is it possible to simplify / clean up svg code by replacing the use-tags with standard svg elements? Maybe an inkscape plugin? Haven t found anything... Background: I m converting some svgs to javafx ...

How to link from SVG?

What I tried is this <a xlink:target="http://ponyoverflow.com"> <text class="text" x="20" y="718" text-anchor="start">Mail Order Ponies</text> </a> and variations with href ...

Ruby Support for SVG

Is there some library or helper to produce SVG graphics with Ruby? I googled a bit and found many, but all seem to be dusty and very incomplete… Does anyone know about some nice, reliable alternative?

Mangling IDs and References to IDs in XML

I m trying to compose xml elements into each other, and the problem I am having is when there s the same IDs. Basically what I need to do is mangle all the IDs in an xml file, as well as the ...

热门标签