Topic: DD menu issue - hiding div layer (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=29362" title="Pages that link to Topic: DD menu issue - hiding div layer (Page 1 of 1)" rel="nofollow" >Topic: DD menu issue - hiding div layer <span class="small">(Page 1 of 1)</span>\

 
panzhuli
Obsessive-Compulsive (I) Inmate

From:
Insane since: Nov 2004

posted posted 07-20-2007 05:25

hey all. i don't know js well at all. i'm trying to hide a div when the mouse rolls off it (dd menu). It is only sometimes hiding it. here's what i have:

<div id="dropdown_menu" onmouseout="doSomething(event);">
<ul>
<li>anchor tag with rollover image</li>
<li>anchor tag with rollover image</li>
</ul>
</div>

and the script (I found on the web)

function doSomething(e) {
if (!e) var e = window.event;
var tg = (window.event) ? e.srcElement : e.target;
if (tg.nodeName != 'DIV') return;
var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
while (reltg != tg && reltg.nodeName != 'BODY')
reltg= reltg.parentNode
if (reltg== tg) return;
// Mouseout took place when mouse actually left layer
// Handle event
hidediv("dropdown_menu");//another fx that works fine
}


thanks in advance.

reisio
Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

posted posted 07-21-2007 09:46

I don't know much about JS, but this'll probably work:

code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<title></title>
		<style type="text/css">
#foo {
	width: 300px;
	height: 300px;
	background: fuchsia;
}
		</style>
	</head>
	<body>
		<div id="foo"></div>
		<script type="text/javascript">
var foo = document.getElementById('foo');
foo.onmouseout = function () {
	foo.style.display = 'none';
}
		</script>
	</body>
</html>



poi will probably stop by and give you a 7-char source that can do it.

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 07-21-2007 10:18

Sorry no 7-char solution
But you could check how it did a similar effect on the navigation of my site. It only use CSS, and add event handler in IE. The code could be nicer but it does the job.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu