metanohi-misc-subsites/old-projects/x/hidemouse.htm

87 lines
1.4 KiB
HTML
Raw Permalink Normal View History

2011-08-02 19:57:57 +02:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3c.org/1999/xhtml" xml:lang="da">
<head>
<title>MouseHide</title>
<style type='text/css'>
body {
background-color:#000;
overflow:hidden;
}
#mouseimg {
cursor:crosshair;
position:absolute;
left:-100px;
top:-100px;
width:17px;
height:17px;
display:none;
}
#div {
/*position:absolute;
left:50%;
top:50%;
margin-left:-200px;
margin-top:-150px;*/
width:400px;
height:300px;
margin:200px auto 0 auto;
background-color:#fff;
}
</style>
<script type="text/javascript">
ox=0
oy=0
m=false
hover=false
function wait() {
if (ox==x && oy==y && !hover) {
mouseimg.style.display="block"
m=false
}
else {
ox=x
oy=y
t=setTimeout("wait()",250)
}
}
function mover(nb) {
if (nb==0)
hover=true
else
hover=false
}
function mouseimgnewloc(e) {
mouseimg.style.display="none"
//document.title=hover
if (e) {
x=e.pageX-8
y=e.pageY-8
}
else {
x=event.x-10
y=event.y-10
}
if (m==false) {
wait()
m=true
}
mouseimg.style.left=x+"px"
mouseimg.style.top=y+"px"
}
window.onload=function(){mouseimg=document.getElementById("mouseimg")}
document.onmousemove=mouseimgnewloc
</script>
</head>
<body>
<img id="mouseimg" alt='' src='img/c.png' />
<div id='div' onmouseover='mover(0)' onmouseout='mover(1)'></div>
</body>
</html>