-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
20 lines (16 loc) · 724 Bytes
/
script.js
File metadata and controls
20 lines (16 loc) · 724 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
document.addEventListener('DOMContentLoaded', () => {
// Select both the spotlight and the new custom cursor
const spotlight = document.querySelector('.spotlight');
const customCursor = document.querySelector('.custom-cursor');
// The event listener now updates BOTH elements
document.addEventListener('mousemove', (e) => {
// Get mouse coordinates
const mouseX = e.clientX;
const mouseY = e.clientY;
// Update the position for both elements
spotlight.style.left = `${mouseX}px`;
spotlight.style.top = `${mouseY}px`;
customCursor.style.left = `${mouseX}px`;
customCursor.style.top = `${mouseY}px`;
});
});