如何用拉斐尔<href ..>我的svg-logo?</href ..>

时间:2011-12-10 11:21:13

标签: svg raphael href

我在我的网站上使用了Raphael.js。请在标题中看一下标志。 http://hooche.ru/md2 徽标代码:

<script type="text/javascript">
    window.onload = function() {    
    var r = Raphael(logo); r.attr({href: "http://google.com/", target: "blank"});
        other vector..
        ...
</script>

和logo ^

的html代码
<div id="logo"></div>

但是现在,我们有:1个字母= 1个Google链接=非常多的Google链接和空的,而不是一个svg徽标中字母周围的可点击空格。

怎么做:1 svg-logo = 1链接到没有空格的地方, 例如,div徽标有:

width: 190px;
height: 67px;

2 个答案:

答案 0 :(得分:0)

用链接替换你的div,那么你也不需要r.attr()位。

<a id="logo" href="http://google.com/"></a>

(我不建议在那里使用target="_blank"。这不是标准行为。让最终用户选择。)

答案 1 :(得分:0)

我想我理解为什么。我必须做这样的事情:

<a id="logo" xlink:href="o-nas.php" title=""></a>
  

的xlink

我在文档中读到了。