Adding hyperlink to a svg:image

1,062 views
Skip to first unread message

geow812

unread,
Sep 5, 2012, 9:31:57 AM9/5/12
to d3...@googlegroups.com
Hi everyone,

I am totally new to d3.js. Now I'm trying this example: http://mbostock.github.com/d3/talk/20111018/tree.html
I've added an image beside each svg:text using:
nodeEnter.append("svg:image")
 .attr("xlink:href", "adress.jpg")
The image appears. When I click it the node will expand or close,  but no hyperlink.

Should I use a svg:a instead or simply do something about the svg:image?

Thx very much =)

Ian Johnson

unread,
Sep 5, 2012, 10:21:29 AM9/5/12
to d3...@googlegroups.com

You can make an svg:a and then append the image inside that. The result is exactly like how you would turn an HTML image into a link.

geow812

unread,
Sep 5, 2012, 10:39:55 AM9/5/12
to d3...@googlegroups.com
Tnx very much it works =)

在 2012年9月5日星期三UTC+2下午4时21分33秒,Ian Johnson写道:
Reply all
Reply to author
Forward
0 new messages