Simple Mouse-Over Show/Hide with Delay Javascript Need

  • Thread starter news.frontiernet.net
  • Start date
N

news.frontiernet.net

I am a cut-n-paste JavaScript user and have bennusing the JavaScript listed
below to do several
things 1) Display/Hide a layer with menu choices, 2) display a layer with
text and images.
//////////////////////////////////////////////////
<script language="JavaScript"><!--
function showByPosition(object,x,y,e) {
if (document.layers && document.layers[object]) {
if ((e.x + x + 50 + document.layers[object].clip.width) >
(window.pageXOffset +
window.innerWidth))
x = x - document.layers[object].clip.width;

if ((e.y + y + 50 + document.layers[object].clip.height) >
(window.pageYOffset +
window.innerHeight))
y *= -4;

document.layers[object].left = e.x + x;
document.layers[object].top = e.y + y;
document.layers[object].visibility = 'visible';
}
else if (document.all) {
e = window.event;

if ((e.x + x + document.all[object].clientWidth) >
(document.body.clientWidth +
document.body.scrollLeft))
x = (document.body.clientWidth + document.body.scrollLeft) -
document.all[object].clientWidth;
else
x = e.x + x;

if ((e.y + y + document.all[object].clientHeight) >
(document.body.clientHeight +
document.body.scrollTop))
y = e.y - (y * 4);
else
y = e.y + y;

document.all[object].style.posLeft = x;
document.all[object].style.posTop = y;
document.all[object].style.visibility = 'visible';
}
}


function hide(object) {
if (document.layers && document.layers[object])
document.layers[object].visibility = 'hidden';
else if (document.all)
document.all[object].style.visibility = 'hidden';
}
//--></script>
/////////////////////////////////////////////

This seems to work in a cross-browser environment. I need that cross-browser
ability.

A working version of the menuing use can be seem at:
http://www.wgtn.net/wow/
A working version of the textual use can be seen at:
http://www.wgtn.net/jobz/

One drawback to this script is that a layer REMAINS visible until either the
visitor chooses to
hide it by clicking on the Hide trigger I provide, OR by selecting one of
the other options that
causes all other layers to hide. I dont like it REMAINING visible.

It would be nice if the script hid the layer after a few seconds unless the
layer has mouse-over
activity in which case it hould remain displayed to allow the visitor to
complete his selection..

Does anyone know of a JavaScript that will do this with the automatic hide
after a few seconds
unless mouce-over activity on the dislayed layer?

Or is there a better script available?
 

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

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top