How to <href..> my svg-logo with Raphael?

五迷三道 提交于 2019-12-11 02:44:26

问题


I'm using a Raphael.js on my site. Take a look logo in the header, please. http://hooche.ru/md2 Code for logo:

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

and html-code for logo^

<div id="logo"></div>

But now, we have: 1 letter = 1 Google link = very much Google links and empty, not clickable spaces around letters in one svg-logo.

How to do: 1 svg-logo = 1 link to somewhere with no empty spaces, for example, div logo have:

width: 190px;
height: 67px;

回答1:


Replace your div with a link, then you won't need the r.attr() bit either.

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

(I would not advise using target="_blank" there. It's not the standard behaviour. Let the end user choose.)




回答2:


I think I understand why. I had to do something like this:

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

xlink

I read in the documentation.



来源:https://stackoverflow.com/questions/8456150/how-to-href-my-svg-logo-with-raphael

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!