Simple Mouse-Over Show/Hide with Delay Javascript Need

Discussion in 'Javascript' started by news.frontiernet.net, Jun 2, 2004.

  1. 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?
     
    news.frontiernet.net, Jun 2, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kelvin
    Replies:
    3
    Views:
    759
    Adrienne Boswell
    May 22, 2007
  2. Targa
    Replies:
    9
    Views:
    633
    Randell D.
    Jan 27, 2005
  3. Don Lancaster

    Need a simple Acrobat JavaScript delay

    Don Lancaster, Mar 3, 2005, in forum: Javascript
    Replies:
    5
    Views:
    233
    Mick White
    Mar 3, 2005
  4. ll
    Replies:
    2
    Views:
    688
    Thomas 'PointedEars' Lahn
    May 1, 2008
  5. shapper
    Replies:
    1
    Views:
    92
Loading...

Share This Page