Forum Moderators: open
For an example, see <snip>
How can I cancel the onmouseout event when it goes into the nested block elements, but keep it active for when the mouse actually leaves the outside edge of the container div?
Reps to the first fix!
Thanks
[edited by: DrDoc at 9:20 pm (utc) on Aug. 23, 2008]
[edit reason] No URIs, please. See posting guidelines. [/edit]
Instead of shrinking the size onmouseout, call setTimeout to shrink the size after some small amount of time (maybe 300ms). Then, add an onmouseover listener that will call cancelTimeout to prevent the method for shrinking the size from being called. Therefore, if you are mousing over any of the nested items, the call to shrink the size will always be cancelled before it can call that method.
I set the onmouseout event on the container div to:
onmouseout="t=setTimeout('hideDiv()',300);"
and on the nested div,
onmouseover="clearTimeout(t);"
Worked like a charm! Thank you, I wasn't aware of a clearTimeout function.
Thanks everyone!