1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>ehCat</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style>
#menuHaut ul
{
list-style-type:none;
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
}
#menuHaut li
{
margin:0px 0px 0px 0px;
padding:0px 0px 0px 0px;
text-align:center;
float:left;
}
#menuHaut li div{
border:1px solid #000;
width:50px;
height:50px;
position:relative;
}
</style>
</head>
<body onload="initMenu();">
<script type="text/javascript">
var t1 = null;
var t2 = null;
var test = 0;
var test2 = 0;
var onmouseoverImg = 0;
var onmouseover = 0;
function moveBtnUp(btn)
{
onmouseover = 1;
clearTimeout(document.getElementById(btn+'Img').t2);
var obj = document.getElementById(btn+'Img').style;
if ( onmouseoverImg == 1 || onmouseoverImg == 0 )
{
// Qu'on touche ou pas l'<img>, le btn monte
if ( parseInt(obj.top) <= 0 && parseInt(obj.top) > -10 )
{
obj.top = parseInt(obj.top)-1+'px';
document.getElementById(btn+'Img').t1 = setTimeout(function(){moveBtnUp(btn);}, 20)
}
}
document.getElementById('test').innerHTML = 'onmouseoverImg='+onmouseoverImg;
document.getElementById('test2').innerHTML = 'onmouseover='+onmouseover;
test++;
}
function moveBtnDown(btn)
{
onmouseover = 0;
clearTimeout(document.getElementById(btn+'Img').t1);
var obj = document.getElementById(btn+'Img').style;
if ( onmouseoverImg == 0 )
{
// Si on ne touche pas l'<img> ni le <li> , le btn descend
if ( parseInt(obj.top) < 0 && parseInt(obj.top) >= -10 )
{
obj.top = parseInt(obj.top)+1+'px';
document.getElementById(btn+'Img').t2 = setTimeout(function(){moveBtnDown(btn);}, 20)
}
}
if ( onmouseoverImg == 1 )
{
// Si on touche <img>, le btn monte
if ( parseInt(obj.top) <= 0 && parseInt(obj.top) > -10 )
{
obj.top = parseInt(obj.top)-1+'px';
document.getElementById(btn+'Img').t2 = setTimeout(function(){moveBtnUp(btn);}, 20)
}
}
document.getElementById('test').innerHTML = 'onmouseoverImg='+onmouseoverImg;
document.getElementById('test2').innerHTML = 'onmouseover='+onmouseover;
test2++;
}
// ----------------------
// Initialise les objets
// ----------------------
function initMenu() {
document.getElementById('aboutBtnImg').style.top = '0px'
document.getElementById('cvBtnImg').style.top = '0px'
document.getElementById('portfolioBtnImg').style.top = '0px'
document.getElementById('contactBtnImg').style.top = '0px'
}
</script>
<div id="main">
<div id="logo"></div>
<div id="menuHaut">
<ul>
<li id="aboutBtn" onmouseover="moveBtnUp('aboutBtn');" onmouseout="moveBtnDown('aboutBtn');" ><a href="#" ><div id="aboutBtnImg" onmouseover="onmouseoverImg=1" onmouseout="onmouseoverImg=0;"/></div></li>
<li id="cvBtn" onmouseover="moveBtnUp('cvBtn');" onmouseout="moveBtnDown('cvBtn');" ><a href="#"><div id="cvBtnImg" alt="" src="images/cvBtn.png" onmouseover="onmouseoverImg=1" onmouseout="onmouseoverImg=0;" /></div></a></li>
<li id="portfolioBtn" onmouseover="moveBtnUp('portfolioBtn');" onmouseout="moveBtnDown('portfolioBtn');" ><a href="#"><div id="portfolioBtnImg" alt="" src="images/portfolioBtn.png" onmouseover="onmouseoverImg=1;" onmouseout="onmouseoverImg=0;" /></div></a></li>
<li id="contactBtn" onmouseover="moveBtnUp('contactBtn');" onmouseout="moveBtnDown('contactBtn');" ><a href="#"><div id="contactBtnImg" alt="" src="images/contactBtn.png" onmouseover="onmouseoverImg=1;" onmouseout="onmouseoverImg=0;"/></div></a></li>
</ul>
</div>
<div id="canap"></div>
<br/><br/><br/><br/>
<p id="test" ></p>
<p id="test2" ></p>
</div>
</body>
</html> |
Partager