I have a simplr svg-graph and I'm trying to create a simple tooltip-popup for this graph, but I'm unable to find out how to set the position of the tooltip properly.
I have a .css where my popup-div is absolute:
#popup {
position: relative
When creating nodes in the svg I hook a listener like:
p.setAttributeNS(null,"onmousemove","parent.drawPopup(evt)");
Now to my problem, in the drawPopup callack, I cannot figure out how to set the coordinates correctly, I've tried something like the following in the drawPopu function:
pop = document.getElementById("popup");
pop.innerHTML = popupText;
pop.style.visibility='visible';
pop.style.left=evt.pageX + 'px';
but the pageX seem to be relative to the svg.graph, so I need to offset it somehow?
How does one usually do with problems like this? Any suggestions?