SBonfiglio
IS-IT--Management
Hello Folks.
I have a customer who hates menus. She would like to see the menu the very few time she needs is, to make the selection and then hide again.
The ideal situation should be to display the menu with a quick fade in, then, if the mouse stops moving, after a certain timeout the menu fades out and disappears again.
I tried the following code, but unsuccessfully:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" src="jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
function hideNav() {
$('#menu').stop().fadeIn(1000);
var menu = $('#menu');
menu.fadeOut(1000);
}
function showNav() {
$('#menu').stop().fadeIn(1000);
var menu = $('#menu');
menu.fadeIn(1000);
}
</script>
<script type="text/javascript">
var hide = setTimeout(function() {
hideNav();
}, 2000);
$(document).mousemove(function() {
clearTimeout(hide);
var hide = setTimeout(function() {
hideNav();
}, 2000);
showNav();
});
</script>
<title>TEST NAVIGATION HIDE-SHOW</title>
</head>
<body>
<div id="menu">
<table width="60%" border="1" cellspacing="0" cellpadding="5" align="center">
<tr>
<td width="20%" align="center">TEST FEATURE 1</td>
<td width="20%" align="center">TEST FEATURE 2</td>
<td width="20%" align="center">TEST FEATURE 3</td>
<td width="20%" align="center">TEST FEATURE 4</td>
<td width="20%" align="center">TEST FEATURE 5</td>
</tr>
</table>
</div>
</body>
</html>
The menu correctly fades out, but the mousemove action doesn't make it appear again.
Is there anybody who can tell me why ?
Thanks in advance for any help.
Sergio
I have a customer who hates menus. She would like to see the menu the very few time she needs is, to make the selection and then hide again.
The ideal situation should be to display the menu with a quick fade in, then, if the mouse stops moving, after a certain timeout the menu fades out and disappears again.
I tried the following code, but unsuccessfully:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" src="jQuery/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
function hideNav() {
$('#menu').stop().fadeIn(1000);
var menu = $('#menu');
menu.fadeOut(1000);
}
function showNav() {
$('#menu').stop().fadeIn(1000);
var menu = $('#menu');
menu.fadeIn(1000);
}
</script>
<script type="text/javascript">
var hide = setTimeout(function() {
hideNav();
}, 2000);
$(document).mousemove(function() {
clearTimeout(hide);
var hide = setTimeout(function() {
hideNav();
}, 2000);
showNav();
});
</script>
<title>TEST NAVIGATION HIDE-SHOW</title>
</head>
<body>
<div id="menu">
<table width="60%" border="1" cellspacing="0" cellpadding="5" align="center">
<tr>
<td width="20%" align="center">TEST FEATURE 1</td>
<td width="20%" align="center">TEST FEATURE 2</td>
<td width="20%" align="center">TEST FEATURE 3</td>
<td width="20%" align="center">TEST FEATURE 4</td>
<td width="20%" align="center">TEST FEATURE 5</td>
</tr>
</table>
</div>
</body>
</html>
The menu correctly fades out, but the mousemove action doesn't make it appear again.
Is there anybody who can tell me why ?
Thanks in advance for any help.
Sergio