-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
33 lines (22 loc) · 723 Bytes
/
Copy pathscript.js
File metadata and controls
33 lines (22 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let main = document.querySelector('.container');
let cursor = document.querySelector('.cursor');
let cursorInner = document.querySelector('.cursor-inner');
// Left & Top tabhi kam karega Jab cursor ko position: absolute di ho gi
main.addEventListener('mousemove', function(details) {
cursor.style.left = details.x +'px'
cursor.style.top = details.y +'px'
console.log('X:', details.x);
console.log('Y:', details.y);
})
/*
let x = 0;
let y = 0;
cursor.addEventListener('mousemove', function(e){
x = e.clientX;
y = e.clientY;
cursor.style.left = x + 'px';
cursor.style.top = y + 'px';
cursorInner.style.left = x + 'px';
cursorInner.style.top = y + 'px';
});
*/