Re: OnMouseOut event and Layers

by "Arcady"<arcady(at)jps.net>

 Date:  Mon, 28 Feb 2000 18:47:25 GMT
 To:  Steve Segarra <ssegarra(at)mitre.org>,
hwg-techniques <hwg-techniques(at)hwg.org>
  todo: View Thread, Original
There's not a clean solution that I know of. But there is a trick that will mostly
work.

Put a border around the popup. Put an image in that border. Even a transparent
gif will do.
Put the onMouseOut in the image. Then be sure to have the mouse focus on something
inside the popup when it comes up. When it will fail is if your image is small
enough that they can move their mouse through it faster than it can react.
To deal with that you can put an 'X' image on the top-right of the border and
make it and the entire border have an OnClick that closes the popup.

Not pretty, but it will work. If you're clever about it you can make that border
integrate nicely into your design.
You may even be able to make the border invisible. If it's transparent they
won't see the border but instead see the layer underneath. If you can pull that
off you could make the border obscenely big. Like 100 pixels wide... :) then
it won't ever fail.

I used a similar trick here:

http://www.geocities.com/arcady0/SR

On the very first page if you mouse over the words in red the image to the left
changes and has text show up underneath. If you move your mouse over to the
text and are not going to fast it will disapear when it passes over the red
line. I did this bit of code merely to test out the idea so it's smaller than
it should be and a fast mouse can 'escape' it.
 But it does provide an example.

>As of javascript 1.2 the layer tag has the onMouseOut event defined. 
>Does anyone know how to, if possible, to use this event if the layers
>are defined through CSS?  
>
>For example,
>	
>I have pop up menus that I defined using <div id="layerName"
>style="POSITION: absolute; Z-INDEX: 20; VISIBILITY: hidden; TOP: 100px;
>LEFT: 200px;">
>But defining the onMouseOut event in the div tag itslef heeds no
>results.  I want to "close" the layers when they mouse leaves the layer,
>but I cannot get an event to throw when the mouse leaves the layer...
>
>Thanks for any help
>Steve
>
>
>

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA