鼠标坐标 clientX 和 ClientY 在 safari 上不起作用

鼠标 clientX 和 ClientY 的坐标在 safari 上运行不佳,这使得 crusor 的导航不流畅,但在所有其他浏览器上都可以使用,如果您有我感兴趣的解决方案,谢谢

<style>
  .cursor{
  position: fixed;
  width: 50px;
  height: 50px;
  border: 1px solid #9C9C9C;
  border-radius: 50%;
  left: 0;
  top: 0;
  pointer-events: none;
  transform: translate(-50%,-50%);
  transition: .1s;
  background: rgba(0,0.05);
  z-index: 1000;
}

.cursor2{
  position: fixed;
  width: 8px;
  height: 8px;
  background-color: #9C9C9C;
  border-radius: 50%;
  left: 0;
  top: 0;
  pointer-events: none;
  transform: translate(-50%,-50%);
  transition: .15s;
  z-index: 1000;
}

</style>



<div class="cursor"></div>
<div class="cursor2"></div>


<script>
var cursor = document.querySelector(".cursor");
var cursor2 = document.querySelector(".cursor2");
document.addEventListener("mousemove",function(e){
  cursor.style.cssText = cursor2.style.cssText = "left: " + e.screenX + "px; top: " + e.screenY + "px;";
});
</script>





zhouwei9993 回答:鼠标坐标 clientX 和 ClientY 在 safari 上不起作用

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/49021.html

大家都在问