extend behavior to congruent div

S

Steven Daedelus

Ok, I've got a div, and it has an onMouseOver handler attached to it
which makes a second div visible. The second div shares part of one side
with the first, but not all.

The first div also has an onMouseOut handler which, you guessed it,
makes the second div invisible.

However, if the user rolls out of the first div and into the second, I'd
like to keep the second div visible.

Any ideas how to accomplish this?

stedae
 
S

Steven Daedelus

Steven Daedelus said:
Ok, I've got a div, and it has an onMouseOver handler attached to it
which makes a second div visible. The second div shares part of one side
with the first, but not all.

The first div also has an onMouseOut handler which, you guessed it,
makes the second div invisible.

However, if the user rolls out of the first div and into the second, I'd
like to keep the second div visible.

Any ideas how to accomplish this?

stedae

As so often happens, I answered my own question moments after posting
this.

To any who are interested, the solution is very simple: put the same
handlers and second div.

stedae
 
L

Lee

Steven Daedelus said:
Ok, I've got a div, and it has an onMouseOver handler attached to it
which makes a second div visible. The second div shares part of one side
with the first, but not all.

The first div also has an onMouseOut handler which, you guessed it,
makes the second div invisible.

However, if the user rolls out of the first div and into the second, I'd
like to keep the second div visible.

Any ideas how to accomplish this?

Rather than making the second div invisible immediately,
the onmouseout handler of the first div schedules it to
happen after a very short delay (50ms?) using setTimeout().
The onmousover handler of the second div cancels that
scheduled event, using clearTimeout().
 
S

Steven Daedelus

Lee said:
Steven Daedelus said:

Rather than making the second div invisible immediately,
the onmouseout handler of the first div schedules it to
happen after a very short delay (50ms?) using setTimeout().
The onmousover handler of the second div cancels that
scheduled event, using clearTimeout().

I tried that. For some reason the timeout was creating all sorts of
weird behaviors besides the one I wanted. But in any case, as my
subsequent post points out, it's not necessary. I discovered that
putting the same handlers on the second div works just fine.
 
L

Lee

Steven Daedelus said:
I tried that. For some reason the timeout was creating all sorts of
weird behaviors besides the one I wanted. But in any case, as my
subsequent post points out, it's not necessary. I discovered that
putting the same handlers on the second div works just fine.

That may not be true in all browsers. In some, the second
div may pop down before it can take focus.
 
S

Steven Daedelus

Lee said:
Steven Daedelus said:

That may not be true in all browsers. In some, the second
div may pop down before it can take focus.

Ah. Good point. I'll check that out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top