Pages

Friday, November 18, 2011

Email Cursor


This script causes an "email me" message to follow your mouse cursor around the page. When clicked the default email client will open so an email can be sent.
Change the message, email addy and font type at the top of the email cursor script. Compatible with normal stylesheet rules for link colors, etc
Very useful and easy to install. :)
Installation:
Copy the code below and paste this into your html document as the last thing on the pagejust above the closing body tag. </body>

<script language="JavaScript"> 
<!-- E-mail Stalker Script by kurt.grigg@virgin.net --> <!-- Get script 
at http://www.hypergurl.com // Change to suit here!------------------ msg="Click 
here to e-mail"; mail="mailto:support@hypergurl.com"; fnt='Verdana'; 
fsze='2'; speed=3; //---------------------------------- Y=0,X=0,my=0,mx=0,angle=0,dy=0,dx=0,tmr=null; 
ns=(document.layers)?1:0; off=(document.layers)?'hide':'hidden'; on=(document.layers)?'show':'visible'; 
if (ns) document.write('<layer name=n top=0 left=0><font face='+fnt+' 
size='+fsze+'><a href='+mail+'>'+msg+'</a></font></layer>'); 
else{ document.write('<div id="c" style="position:absolute"><div 
style="position:relative">'); document.write('<div id="i" 
style="position:absolute;width:200px;height:30px"><font face='+fnt+' 
size='+fsze+'><a href='+mail+'>'+msg+'</a></font></div>'); 
document.write('</div></div>'); } if (ns){ window.captureEvents(Event.MOUSEMOVE); 
function nMouse(evnt){ my=evnt.pageY+20;mx=evnt.pageX } } else{ function iMouse(){ 
my=event.y+20;mx=event.x; } } function stalk(){ if (ns) window.onMouseMove=nMouse; 
else {document.onmousemove=iMouse;c.style.top=document.body.scrollTop} var layer=(document.layers)?document.n:i.style; 
Y=my-dy;X=mx-dx; angle=Math.round(Math.atan2(Y,X)*180/Math.PI); if (angle < 
0) angle += 360; y = Math.round(speed*Math.sin(angle*Math.PI/180));x = Math.round(speed*Math.cos(angle*Math.PI/180)); 
dy+=y;dx+=x; if ((dy > my-speed*2) && (dx > mx-speed*2) && 
(dy < my+speed*2) && (dx < mx+speed*2)) {clearTimeout(tmr);layer.visibility=off;} 
else{layer.visibility=on;layer.top=dy;layer.left=dx} tmr=setTimeout('stalk()',10); 
} stalk(); //--> </script>

No comments:

Post a Comment