Posted By

Butscharoni on 02/07/08


Tagged

fix


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

rafael


IsMouseLeaveOrEnter - Fix for mouseover/mouseout


 / Published in: JavaScript
 

URL: http://www.dynamic-tools.net/toolbox/isMouseLeaveOrEnter/

So the event is fired only once when hovering over child elements

  1. // this function determines whether the event is the equivalent of the microsoft // mouseleave or mouseenter events.
  2. function isMouseLeaveOrEnter(e, handler) {
  3. if (e.type != 'mouseout' && e.type != 'mouseover') return false;
  4. var reltg = e.relatedTarget ? e.relatedTarget :
  5. e.type == 'mouseout' ? e.toElement : e.fromElement;
  6. while (reltg && reltg != handler) reltg = reltg.parentNode;
  7. return (reltg != handler);
  8. }

Report this snippet  

You need to login to post a comment.