Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Can you appy a tooltip to a rect tag?

edited September 2015 in Tipped
I've got a simple SVG drawing like this:

<svg title="tooltip">
<rect x="10" y="10" width="100" height="100" title="tooltip" />
</svg>


$(document).ready(function() {
Tipped.create('svg');
Tipped.create('rect');
});


The tooltip works for the svg, but nothing shows up for the rect.

Is it possible to use tippedjs with rect tags? Or am I forgetting something?

Comments

  • edited September 2015
    No, tooltips don't work with svg shapes because jQuery doesn't support svg.

    SVG elements are not something you can reliably get a position from using DOM methods. You might expect that to work for a rect but svg shapes can also be abstract shapes, jQuery can't get position (x/y) and dimensions (width/height) of such shapes.

    Maybe there are plugins that add this support to jQuery but I'm not aware of them. I suggest to use actual DOM elements if you need tooltip support. The rect for example could also be a div with an absolute position.
  • Ah damn.

    Thank you for the explanation though Nick. And whilst I've got you, thanks for TippedJS. I like Qtip2 but I always felt overwhelmed.

    Greg.
Sign In or Register to comment.