Simple Mouse Trail using VB Script

Simple Mouse Trail using VB Script



<script language=VBScript> Sub document_onMouseMove(eventcapture) my_stuff.style.left=eventcapture.screenX-50 my_stuff.style.top=eventcapture.screenY-100 End sub </script> Whatever you want, even images: Following the cursor is really very easy in VB script. Simply set up a span tag with an id of, say 'my_stuff' then use the built in IE subroutine document_onMouseMove to set the absolute position of the span. You can adjust the amount to get it just where you want in relation to the cursor. What could be easier?

As an adjunct to this, if you move the cursor around on this page you will see that the trailing text attempts to adjust itself to fit - try pushing it up against the right margin for example.

One final word of warning, if your page scrolls down (as this one does) you will lose the mouse trail. To keep it we would need to take account of the document.body.scrollTop position - but that's for another time.

For now, enjoy the simplicity of this little script.

Select All Code



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值