+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Oct 2003
    Posts
    267

    Div Layer On Mouse Out

     
    Hey all...I am working on an navigation section on a web app in .net....

    here is what I am trying to do...

    When a users mouse goes over a link a div layer will appear (sub menu)...this isnt the problem....


    When the user gets off of the div then the div layer should disappear.

    The problem I am having is in firefox...It is complaining about my code that works in IE....There might be a better way of doing this. Just putting the <div onmouseout="SetHidden();" is causing issues when they click any of the <li> items with in the div...

    Here is the code that works in IE...

    Code:
    function SetDivLayer()
    {
    var divLayer;
    divLayer=document.getElementById("divGallery");
    
    if (!event.fromElement.contains(event.toElement) &&!document.getElementById('divGallery').contains(event.toElement))
    	divLayer.style.visibility='hidden';
    
    
    }


    DIV LAYER Code
    Code:
    <DIV id="divGallery" style="Z-INDEX: 101; LEFT: 100px; WIDTH: 128px; VISIBILITY: hidden; COLOR: white; POSITION: absolute; TOP: 350px; HEIGHT: 57px; BACKGROUND-COLOR: gray"
    			ms_positioning="GridLayout" language="javascript" noWrap onmouseout="SetDivLayer()";  >
    			<table width="100%" height="100%"  border="0">
    			<tr>
    			<td><FONT color="Red"><b>Gallery 1</b></font></td>
    			</tr>
    			<tr>
    			<td><FONT color="Red"><b>Gallery 2</b></font></td>
    			</tr>
    			</table>
    </DIV>

    Anyone have any suggestions on how to do this in a better manner?

    I need this to work in both IE and Firefox...

    Thanks for your help in advance...

  2. #2
    Member
    Join Date
    Oct 2003
    Posts
    267
    i was able to figure out the answer...for people that want to know...


    function SetDivLayer(event)
    {


    var toElement = null;

    //if (event.srcElement.tagName == "DIV")
    //divLayer.style.visibility='hidden';

    //if (!event.fromElement.contains(event.toElement) &&!document.getElementById('divGallery').contains( event.toElement))
    // divLayer.style.visibility='hidden';

    if (event.relatedTarget) {
    toElement = event.relatedTarget;
    }
    else if (event.toElement) {
    toElement = event.toElement;
    }

    while (toElement && toElement.id != 'divGallery') {
    toElement = toElement.parentNode;
    }

    if (!toElement) {
    if (document.getElementById) {
    document.getElementById('divGallery').style.visibi lity = 'hidden';

    }
    }

    }




    onmouseout="SetDivLayer(event)";

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to make a DIV rest at the bottom of another DIV in CSS?
    By celebritymusic in forum Webmastering and Programming
    Replies: 1
    Last Post: March 1st, 2007, 10:15 AM
  2. single layer / dual layer
    By razorblade696 in forum General Tech Discussion
    Replies: 4
    Last Post: April 14th, 2005, 12:42 PM
  3. CSS DIV Problems
    By Cyberlore in forum Webmastering and Programming
    Replies: 0
    Last Post: March 6th, 2004, 03:49 AM
  4. Replies: 8
    Last Post: January 6th, 2004, 10:48 PM

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Recommended Sites: ResellerRatings Store Reviews