little jim
12-11-2003, 01:24 AM
I was wondering hw you do that cool thing with the mouse where you have images following it?:confused:
|
Click to See Complete Forum and Search --> : How do you do that cool thing with the mouse?? little jim 12-11-2003, 01:24 AM I was wondering hw you do that cool thing with the mouse where you have images following it?:confused: Gollum 12-11-2003, 02:40 AM opinions are optional ;) but here's how it's done... <html> <head> <script type="text/javascript"> var x = 0; var y = 0; var mx = 0; var my = 0; function mousemove() { mx = event.x; my = event.y; } function moveText() { var dx = mx - x; var dy = my - y; x += dx / 10; y += dy / 10; var oSpan = document.getElementById('txt'); oSpan.style.left = x; oSpan.style.top = y; window.setTimeout("moveText();",50); } window.setTimeout("moveText();",250); </script> <body onmousemove="mousemove();"> <span id=txt style="position:absolute;">Annoying isn't it!</span> </body> </html> webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |