dojo connect mouseover and mouseout

Posted by peirix on Stack Overflow See other posts from Stack Overflow or by peirix
Published on 2010-04-13T13:23:58Z Indexed on 2010/04/13 13:33 UTC
Read the original article Hit count: 298

Filed under:

When setting up dojo connections to onmouseover and onmouseout, and then adding content on mouseover, dojo fires the onmouseout event at once, since there is new content. Example:

dojo.query(".star").parent().connect("onmouseover", function() {
    dojo.query("span", this).addContent("<img src='star-hover.jpg'>");
}).connect("onmouseout", function() {
    dojo.destroy(dojo.query("img", this)[0]);
});

The parent() is a <td>, and the .star is a span. I want to add the hover image whenever the user hovers the table cell. It works as long as the cursor doesn't hover the image, because that will result in some serious blinking. Is this deliberate? And is there a way around it?

© Stack Overflow or respective owner

Related posts about dojo