[Seaside] Detecting when mouse goes out of a div (I mean really
renggli at gmail.com
Sat Aug 4 07:16:16 UTC 2007
I have been using onMouseOver and onMouseOut in several projects and
these events mostly worked for me as expected. I would rather prefer
to call these events onMouseEnter and onMouseExit, but anyway.
> I imagine that you also found awsome the DOM "feature" that client
> agents decided to implement in which you receiver #mouseout events
> even when the mouse goes more deep *inside* that div (sub elements).
This is because your sub-elements also trigger the event and the it
bubbles upwards in the DOM tree (unless you cancel it). To avoid that
you have to manually check in the event object if this is the right
element to handle. For details see:
> I was able to implement some js wrappers to manage that but I'm not
> *that* satisfied with the results (mainly because js VMs being so slow
> todays and having such *pieces* of garbage collectors among other wonders).
What do you exactly do that it is so slow? Event handlers should be
reasonably short to avoid the whole system getting slow.
> So I wnated to ask how other seasiders have managed to detect the case
> in which the pointer in fact goes out an element's surface. One typical
> application for this is making a menu to collapse when pointer get out it's
> surface (and no submenu open). Did you managed a case like this?
You can do that also with pure CSS. For example:
More information about the Seaside