手机版

JS实现的鼠标跟随代码(卡通手型点击效果)

时间:2021-09-29 来源:互联网 编辑:宝哥软件园 浏览:

本文实例讲述了射流研究…实现带有小手点击效果的鼠标跟随代码。分享给大家供大家参考,具体如下:

一个跟随鼠标的小手效果,鼠标移在哪里,小手就跟着移向哪里,会出现手的效果,放在链接上的时候,手会变化,两只手很可爱哦,JS鼠标跟随代码分享与大家。

运行效果截图如下:

在线演示地址如下:

http://demo.jb51.net/js/2015/js-handle-style-focus-codes/

具体代码如下:

!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN ' ' http://www .w3。org/TR/XHTML 1/DTD/XHTML 1-Transitional。DTD ' html xmlns=' http://www .w3。org/1999/XHTML ' hearteta http-equiv=' Content-Type ' Content=' text/html;charset=utf-8' /title可爱的鼠标跟随/title样式html { background : # 000}正文,html,输入{ cursor:none}正文,html { height :100%;} #光标{ position : absolute eleft :100 pxtop :100 px显示:块;}/style脚本窗口。onload=function(){ var oCursor=document。getelementbyid(“光标”);文件。onmousemove=function(ev){ var oEvent=ev | | event,oWidth=document。文档元素。客户端宽度,Oheight=文档。文档元素。客户端高度,滚动顶部=文档。文档元素。滚动顶部oEvent。clienty,向左滚动=文档。文档元素。向左滚动oEvent。clientxif(向上滚动Oheat-Oucsor。抵消热量){ Ocursor。风格。top=Oheat-Ocursor。偏移热量“px”;} else if(滚动到前0){ ocursor。风格。top=0;} else { ocursor。风格。top=滚动顶部“px”;} if(scrolleft oWidth-ocursor。offsetdth){ ocursor。风格。left=oWidth-ocursor。offsetidth ' px} else { ocursor。风格。left=scrolleft ' px}文档。onmousedown=function(){ ocursor。inner html=' img src=' images/cursor _ hover。png '/';返回false}文档。onmouseup=function(){ ocursor。inner html=' img src=' images/cursor。png '/';} };}/script/head dydiv id=' cursor ' img src=' http : images/cursor。png '/divinput type=' button ' style=' font-size :36 px;余量:100px值='点击onclick=' window。open(' http://www .百度。com ')'//body/html希望本文所述对大家Java脚本语言程序设计有所帮助。

版权声明:JS实现的鼠标跟随代码(卡通手型点击效果)是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。