Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create an SVG "tooltip"-like box?

Tags:

svg

tooltip

popup

Given an existing valid SVG document, what's the best way to create "informational popups", so that when you hover or click on certain elements (let's say ) you popup a box with an arbitrary amount (i.e. not just a single line tooltip) of extra information?

This should display correctly at least in Firefox and be invisible if the image was rasterized to a bitmap format.

like image 828
morais Avatar asked Sep 19 '08 14:09

morais


People also ask

How do I create a custom tooltip?

Basic Tooltip HTML: Use a container element (like <div>) and add the "tooltip" class to it. When the user mouse over this <div>, it will show the tooltip text. The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" .

Can you put an image in a tooltip?

JavaScript Tooltip OptionsYou can also add a tooltip to an image or any other HTML element using the programming language JavaScript. You can use an existing library for this purpose, and there are many open source ones available that can let you use tooltips with a variety of different designs.

How do I create a tooltip table?

Select your table visual. Go to the paint roller icon (format). Scroll down and turn on Tool Tip.

What is a hover tooltip?

Alternatively known as a balloon, help balloon, flyover help, or ScreenTip, a Tooltip is a text description near an object. The tooltip is displayed when the user hovers the mouse cursor over the object.


2 Answers

This question was asked in 2008. SVG has improved rapidly in the intervening four years. Now tooltips are fully supported in all platforms I'm aware of. Use a <title> tag (not an attribute) and you will get a native tooltip.

Here are the docs: https://developer.mozilla.org/en-US/docs/SVG/Element/title

like image 126
Neil Fraser Avatar answered Oct 19 '22 13:10

Neil Fraser


<svg>   <text id="thingyouhoverover" x="50" y="35" font-size="14">Mouse over me!</text>   <text id="thepopup" x="250" y="100" font-size="30" fill="black" visibility="hidden">Change me     <set attributeName="visibility" from="hidden" to="visible" begin="thingyouhoverover.mouseover" end="thingyouhoverover.mouseout"/>   </text> </svg> 

Further explanation can be found here.

like image 21
Sparr Avatar answered Oct 19 '22 13:10

Sparr