Tippyjs: Doesn't Work on SVG elements

Created on 9 May 2017  路  11Comments  路  Source: atomiks/tippyjs

I tried adding a title attribute to an SVG circle, but it doesn't work. Is this feature currently available?

Most helpful comment

Thanks for the great demo @atomiks! I'm new to Tippy.js and this was super helpful. In case anyone comes across this in the future, I updated the last demo to work with v2.0.8: http://jsfiddle.net/nholden/b7yk6mbb/1/

All 11 comments

Can you use a div wrapper around it and put the title on that instead?

Thanks for your response! I wanted to try that, but I can't. I am using an SVG canvas and I have multiple SVG objects in that canvas populated using D3.

Are you using a <title> tag like this?

<svg xmlns="http://www.w3.org/2000/svg">
  <rect x="20" y="30" width="200" height="150">
    <title>Hello, World!</title>
  </rect>
</svg>

This won't work currently as it only checks a title attribute on the element rather than a node like that. I can add it in as a feature for the next release though!

Nope! I am using it like:

<circle cx="68.572" cy="50" r="36.97051207883934" title="Hello, World!"></circle>

If this doesn't work then it's alright. I'll have to find my way around this. Thank you so much nonetheless! Tippy has been great so far!

Are you passing in the svg element to be tooltipped or the circle node there?

If you pass it directly to the element with the actual title attribute, it will work: http://jsfiddle.net/819nouob/

Thank you so much! This is great! What if I have multiple SVG elements? Can I do a select all? you're a life-saver!

In that case, pass just a CSS selector in: http://jsfiddle.net/819nouob/3/

If you have different types of elements, you can just separate them by commas like new Tippy('svg rect, svg circle')

Works! Thank you so much, atomiks! I have no idea how I can ever repay you! You saved my life!

Awesome =]

Thanks for the great demo @atomiks! I'm new to Tippy.js and this was super helpful. In case anyone comes across this in the future, I updated the last demo to work with v2.0.8: http://jsfiddle.net/nholden/b7yk6mbb/1/

Nice, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Christian24 picture Christian24  路  3Comments

kmanolis picture kmanolis  路  4Comments

gclark18 picture gclark18  路  4Comments

jemhuntr picture jemhuntr  路  4Comments

andrewckor picture andrewckor  路  4Comments