Javascript Tooltip / Posts /

tooltip disables onmouseout

1
I have the following code:

var item = "<img class='thumb' ...
         + " onmouseout=mouseMovedFromItem(" + eventId + ")" 
         + " onmouseover=createTooltip(this," + eventId + ")" 
        + " onClick=fly(" + eventId + ")" 
        + ">";

Problem is, after I added createTooltip, onmouseout stopped working. How can this be fixed?
Eva  11 years ago   viewed: 4306    

2 Answers

0
The tooltip will override the onmouseout event of the item. You should avoid binding onmouseout event to the element that has the onmouseover="tooltip.open(this, '...')" event.

You can try this:
var item = "<span onmouseout=mouseMovedFromItem(" + eventId + ")><img class='thumb' ...
         + " onmouseover=createTooltip(this," + eventId + ")" 
        + " onClick=fly(" + eventId + ")" 
        + " /></span>";
milo   11 years ago
0

Hello, the issue you're facing is likely due to the way event handling is set up in your HTML string. When you add the onmouseover event for the tooltip, it may interfere with the onmouseout event if the tooltip is being created in a way that keeps the mouse over the image. I think you can delay the execution of mouseMovedFromItem using setTimeout, which can help ensure that the mouse has truly left the area:

geometry dash lite

javascript

var item = "<img class='thumb' ... " 

         + " onmouseout='setTimeout(mouseMovedFromItem(" + eventId + "), 100)' " 

         + " onmouseover='createTooltip(this, " + eventId + ")' " 

         + " onClick='fly(" + eventId + ")' " 

         + ">";

jamesmroz
  one month ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: