Hallo!
What is the right way to display tooltips over objects? My problem is 
that my code (and any example of tooltips I have so far looked at) 
does only work at zoom-level 0. When you zoom in the toolstips are 
way of. I have found one example which correctly displays tooltips on 
different zoomlevels. They use the mousemove event.
http://svglbc.datenverdrahten.de/?code=tooltip&znr=on
Somehow I cannot transfer this to mouseover.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd";>
<svg xmlns="http://www.w3.org/2000/svg"; width="100%" height="100%" 
onload="init(evt)">
        <defs>
                <script type="text/javascript"><![CDATA[
                        var doc;
                        var svgroot;
                        
                        function init(evt) {
                                doc = evt.getTarget().getOwnerDocument
();
                                svgroot = doc.documentElement;
                        }
                        
                        function showTooltip(evt) {
                                //alert("Tooltip");
                                tooltip = doc.getElementById
("tooltip");
                                var x = evt.clientX;
                                var y = evt.clientY;
                                tooltip.setAttribute
("visibility", "visible");
                                curtrans=svgroot.currentTranslate;
                                ctx=curtrans.x;
                                cty=curtrans.y;
                                alert(ctx + "," + cty);
                                tooltip.setAttribute
("transform", "translate(" + (x-ctx) + "," + (y-cty) + ")");
                                setTimeout('hideTooltip()',  3000);
                        }
                        function hideTooltip() {
                                tooltip = doc.getElementById
("tooltip");
                                tooltip.setAttribute
("visibility", "hidden");
                        }
                ]]></script>
        </defs>
        <desc>
                <!-- put a description here -->
        </desc>
        <g>
                <circle r="5" cx="50" cy="50" fill="red" 
onmouseover="showTooltip(evt)"/>
                <circle r="5" cx="250" cy="250" fill="blue" 
onmouseover="showTooltip(evt)"/>
        </g>
        <g id="tooltip" visibility="hidden">
                <rect width="100" height="50" x="5" y="5" 
fill="black" fill-opacity="0.45"/>
                <rect width="100" height="50" fill="white"/>
                <text id="driver" x="6" y="20">bla</text>
                
        </g>
</svg>

What's wrong with this?

Thanks,

Hans





-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to