Skip to content

Commit c49e478

Browse files
committed
Feat: Custom glowing cursor
Fix: naming
1 parent fb16558 commit c49e478

3 files changed

Lines changed: 50 additions & 1 deletion

File tree

Rashed Code 23/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ <h3><a class="home" href="../index.html">Class Repo Projects</a> | Rashed - Code
2424
<a href="Final JS Project/index.html">07 (Final JS Project)</a>
2525
<a href="React/1/dist/index.html">08 (React Project)</a>
2626
<a href="React/2/dist/index.html">09 (React Project)</a>
27-
<a href="#">10 (Cannot be opened)</a>
27+
<a href="#">10 (React Project)</a>
2828
</div>
2929
<footer>© 2025 Class Repo | MDJAmin</footer>
3030
<script src="../js/script.js"></script>

css/style.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ h3 {
5050
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
5151
}
5252

53+
.links a[href="#"] {
54+
opacity: 0.6;
55+
cursor: not-allowed;
56+
border-style: dashed;
57+
}
58+
59+
.links a[href="#"]:hover {
60+
color: #000000;
61+
background: none;
62+
transform: none;
63+
}
5364
.home {
5465
color: rgba(255, 255, 255, 0.571);
5566
transition: color 0.5s;
@@ -140,3 +151,18 @@ footer {
140151
padding: 0.8rem;
141152
}
142153
}
154+
155+
.cursor {
156+
width: 30px;
157+
height: 30px;
158+
border: 2px solid white;
159+
border-radius: 50%;
160+
position: fixed;
161+
top: 0;
162+
left: 0;
163+
pointer-events: none;
164+
transform: translate(-50%, -50%);
165+
transition: transform 0.15s ease;
166+
mix-blend-mode: difference;
167+
z-index: 9999;
168+
}

js/script.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,26 @@ document.body.addEventListener("mousemove", (e) => {
1414
const y = e.clientY / window.innerHeight;
1515
document.body.style.background = `radial-gradient(circle at ${x * 100}% ${y * 100}%, #111, #000)`;
1616
});
17+
18+
// Custom glowing cursor
19+
document.addEventListener("DOMContentLoaded", () => {
20+
const cursor = document.createElement("div");
21+
cursor.classList.add("cursor");
22+
document.body.appendChild(cursor);
23+
24+
let x = 0, y = 0;
25+
let targetX = 0, targetY = 0;
26+
27+
document.addEventListener("mousemove", (e) => {
28+
targetX = e.clientX;
29+
targetY = e.clientY;
30+
});
31+
32+
function animate() {
33+
x += (targetX - x) * 0.15;
34+
y += (targetY - y) * 0.15;
35+
cursor.style.transform = `translate3d(${x}px, ${y}px, 0)`;
36+
requestAnimationFrame(animate);
37+
}
38+
animate();
39+
});

0 commit comments

Comments
 (0)