鼠标 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>