Note that there are some explanatory texts on larger screens.

plurals
  1. PORaphael JS Tooltip does not show on first hover
    primarykey
    data
    text
    <p>Currently I have a arena map created with raphael, each svg element on the map has a tooltip when hovered over. The tooltip does not show on the first hover of an svg element, but it will show if the user enters the svg element again. </p> <p>I assume it has something to do with my addTip "mouseeneter" function but I am still new with understanding JS so I am not sure. Here is the code I am using for adding the tooltip to the svg element on hover, the code I am using is based off of this <a href="https://stackoverflow.com/questions/3417479/how-to-do-a-tooltip-on-an-svg-generated-by-raphael">stackoverflow forum question</a> and the jsfiddle I have created <a href="http://jsfiddle.net/knottAverage/ArKDp/16/" rel="nofollow noreferrer">link</a></p> <pre><code> var tip = $("#tip").hide(); var tipText = "Tip the Canoe."; var over = false; function addTip(node, txt) { $(node).mouseenter(function(){ tipText = txt; tip.fadeIn(); over = true; }) .mouseleave(function(){ tip.fadeOut(); over = false; }); } for (var i = 0, len = rsrGroups.length; i &lt; len; i++) { var el = rsrGroups[i]; el.mouseover(function() { addTip(this.node, tipText); console.log(node); this.toFront(); this.attr({ cursor: 'pointer', fill: '#990000', }); //alert('test'); }); el.mousemove(function(e){ if (over){ tip.css("left", e.clientX+20).css("top", e.clientY+20); tip.text(tipText); } }); el.mouseout(function() { this.attr({ fill: '#003366' }); }); el.click(function() { this.attr({ fill: 'green' }); }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload