html 手型鼠标-JS实现的键盘跟随代码(q版手型点击效果)

2023-09-02 0 6,961 百度已收录

本文主要介绍JS实现的键盘跟随代码,带有q版手按效果。 有需要的同学可以参考JavaScript键盘干扰响应及页面元素动态调用方法html 手型鼠标html 手型鼠标,如下:

小手跟随键盘的效果。 键盘移动到哪里,小手就会跟着移动。 手的效果就会出现。 当它放在链接上时,手形会发生变化。 两只手非常帅气。 与大家分享一下JS键盘下面的代码

运行效果截图如下:

html 手型鼠标-JS实现的键盘跟随代码(q版手型点击效果)

html 手型鼠标-JS实现的键盘跟随代码(q版手型点击效果)

在线演示地址如下:

html 手型鼠标-JS实现的键盘跟随代码(q版手型点击效果)

具体代码如下:




可爱的鼠标跟随

html{ background:#000;}
body,html,input{ cursor:none;}
body,html{ height:100%;}
#cursor{ position:absolute; left:100px; top:100px; display:block;}


 window.onload = function(){
  var oCursor = document.getElementById("cursor");
  document.onmousemove=function (ev){
   var oEvent=ev||event,
    oWidth = document.documentElement.clientWidth,
    oHeight = document.documentElement.clientHeight,
    scrollTop=document.documentElement.scrollTop + oEvent.clientY,
    scrollLeft=document.documentElement.scrollLeft + oEvent.clientX;
   if(scrollTop > oHeight-oCursor.offsetHeight){
    oCursor.style.top = oHeight-oCursor.offsetHeight+'px';
   }else if(scrollTop  oWidth-oCursor.offsetWidth){
    oCursor.style.left = oWidth-oCursor.offsetWidth+'px';
   }else{
    oCursor.style.left = scrollLeft+'px';
   }
   document.onmousedown = function(){
    oCursor.innerHTML = ""; 
    return false;
   }
   document.onmouseup = function(){
    oCursor.innerHTML = ""; 
   }
  };
 }



收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悟空资源网 html html 手型鼠标-JS实现的键盘跟随代码(q版手型点击效果) https://www.wkzy.net/game/189348.html

常见问题

相关文章

官方客服团队

为您解决烦忧 - 24小时在线 专业服务