Fix cursor movement functionality on page load

This commit is contained in:
2026-06-03 23:47:36 +02:00
parent 9b8c273c21
commit f85b596a66

View File

@@ -15,14 +15,21 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
}); });
const cursor = document.getElementById('custom-cursor'); window.addEventListener('load', () => {
const cursor = document.getElementById('custom-cursor');
const gsapInstance = window.gsap;
document.addEventListener('mousemove', (e) => { if (!cursor || !gsapInstance) {
gsap.to(cursor, { return;
duration: 0.2, }
x: e.clientX + 20,
y: e.clientY - 15, document.addEventListener('mousemove', (e) => {
ease: 'power2.out' gsapInstance.to(cursor, {
duration: 0.2,
x: e.clientX + 20,
y: e.clientY - 15,
ease: 'power2.out'
});
}); });
}); });