Thread: Div Layer On Mouse Out
-
August 4th, 2007, 08:11 PM #1Member
- 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...
-
August 4th, 2007, 08:44 PM #2Member
- 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
-
How to make a DIV rest at the bottom of another DIV in CSS?
By celebritymusic in forum Webmastering and ProgrammingReplies: 1Last Post: March 1st, 2007, 10:15 AM -
single layer / dual layer
By razorblade696 in forum General Tech DiscussionReplies: 4Last Post: April 14th, 2005, 12:42 PM -
CSS DIV Problems
By Cyberlore in forum Webmastering and ProgrammingReplies: 0Last Post: March 6th, 2004, 03:49 AM -
Wait for dual layer DVD, or go with DVD-R single layer? + Some Video editing Q's
By implexant in forum Multimedia and AudioReplies: 8Last Post: January 6th, 2004, 10:48 PM



LinkBack URL
About LinkBacks



Reply With Quote

Who would have imagined staid Geneva to be showing ...well to be hosting CooLCarZ > > > High-Performance in Geneva on MSN Photos I'm not sure what the "concept" is behind these "concept...
Sunday Morning in NY and GOOD...