Skip to content

Commit

Permalink
Create animated-cursor.js
Browse files Browse the repository at this point in the history
  • Loading branch information
dhairyagothi authored Feb 25, 2024
1 parent 40358ac commit 0883e47
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Animated-cursor/animated-cursor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const cursor = document.querySelector(".cursor")

document.addEventListener("mousemove",(e)=>{

let x = e.pageX;
let y = e.pageY;

cursor.style.top = y + "px";
cursor.style.left = x + "px";
cursor.style.display = "block";
})

document.addEventListener("mouseout",(e)=>{
cursor.style.display = "none" ;
})

0 comments on commit 0883e47

Please sign in to comment.