View Full Version : Mouse Tracking layer
Keltoi
07-15-2002, 02:39 PM
I know it sounds cheesie, but can anyone point me in the direction of a script which will anchor a layer to the mouse postition?
It needs to be anchored to the mouse (0 or X pixels away) and not track like some of the mouse effects you see around.
Anyone know of an existing script or can help in anyother way?
TIA
Keltoi
x_goose_x
07-15-2002, 06:46 PM
<html>
<head>
<script language="JavaScript1.2">
xoff = 20;
yoff = 40;
document.onmousemove = getMouseXY;
function getMouseXY(e) {
tempX = event.clientX + document.body.scrollLeft
tempY = event.clientY + document.body.scrollTop
document.getElementById("follow").style.left = tempX + xoff;
document.getElementById("follow").style.top = tempY + yoff;
return true
}
</script>
</head>
<body>
<div id="follow" style="position:absolute;">hello</div>
</body>
</html>
Any good?
Keltoi
07-15-2002, 11:34 PM
That's superb x_goose_x, thanks a lot :thumbsup:
Just got in from a rather nice drinking session, so will impliment fully when I get back to work in the morning. :rolleyes:
Once again, thanks I'll comfirm all is well in the morn.
Keltoi
Keltoi
07-16-2002, 11:49 AM
Works a treat, though needed to make a few alterations due to conflicts with existing code.
as with all things... 'tis easy when you know how.
many thanks :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.