From 684c1ce7bd3589d41b53858f3121be8b3263158e Mon Sep 17 00:00:00 2001 From: Ravi Nandan Ray Date: Sun, 13 Oct 2024 09:25:20 +0530 Subject: [PATCH] basic changes in cursour tracking --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 07a348e..cc5a078 100644 --- a/index.js +++ b/index.js @@ -82,15 +82,15 @@ tag.addEventListener("click", (event) => { document.addEventListener("mousemove", (e) => { let x = e.pageX; let y = e.pageY; - myDiv.style.left = x - 20 + "px"; - myDiv.style.top = y - 20 + "px"; + myDiv.style.left = x + "px"; + myDiv.style.top = y + "px"; }); //For touch document.addEventListener("touchmove", (e) => { let x = e.pageX; let y = e.pageY; - myDiv.style.left = x - 20 + "px"; - myDiv.style.top = y - 20 + "px"; + myDiv.style.left = x + "px"; + myDiv.style.top = y + "px"; });