Hiermenus Go Forth, XXVIII - DHTML Lab | 4 | WebReference

Hiermenus Go Forth, XXVIII - DHTML Lab | 4


Logo

Hiermenus Go Forth, XXVIII:
Version 4.2.2 - The Complete Script (Full-Window)



Mousewheel Support for IE6Win

IE6 for Windows introduced the onmousewheel event for all HTML elements. The official documentation can be found at MSDN. This event fires when a user rotates the wheel found on all new mice.

In Version 4.2.2, if the user's browser supports the onmousewheel event (currently only IE6Win) then a scrollable menu can be scrolled by placing the mouse pointer over the menu and pressing and rotating the mousewheel. The menu scrolls up or down by an increment equal to the height of the item the mouse is over.

Streamlined Mouse Events for IE5.5+Win

IE5.5 for Windows introduced the long-in-coming onmouseenter and onmouseleave events.

We have discussed the limitations and unwanted behavior of the standard onmouseover and onmouseout events as implemented by IE4+ many times in these pages.

If you pop over to our IE event discussion in HM Version 1.0, you will find details of the problem introduced by these events when combined with the IE event-bubbling model, as well as a left-column tool that illustrates it. Clumsy workarounds were introduced at the time to avoid flickering in IE4. More recent IE versions, starting with IE5, have addressed the flicker problem but the events still continue to fire unecessarily on all contained elements.

The IE event-bubbling model is very powerful and extremely useful for handling events. All events, that is, except for onmouseover and onmouseout. Unlike all other events, these two fire events that signal entry or exit from an element. In other words they can be self-cancelling if fired from a contained element. This is illustrated in the Version 1.0 article mentioned above.

Finally, in IE5.5 onmouseenter and onmouseleave came into being to do the job that we all expected onmouseover and onmouseout to do originally: fire only when the user enters or leaves the element the handlers are assigned to, pure and simple.

Even though the flicker no longer exists in newer IE versions, we have substituted onmouseenter and onmouseleave for onmouseover and onmouseout in browsers that support these events for more elegant and efficient code execution.

MSDN documentation:
- onmouseenter
- onmouseleave

On the next page, a couple of bug/problem fixes.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: March 07, 2002
Revised: March 07, 2002

URL: http://www.webreference.com/dhtml/column64/3.html