perf: optimize images and throttle/disable magic cursor on mobile

This commit is contained in:
mstfyldz
2026-05-05 00:10:04 +03:00
parent 5808186afc
commit 7ea420daba
2 changed files with 27 additions and 19 deletions

View File

@@ -167,7 +167,7 @@
<div class="about-us-image">
<div class="about-img-1">
<figure class="image-anime reveal">
<img src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917585/muglasurucukursu/araba1.jpg" alt="">
<img src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917585/muglasurucukursu/araba1.jpg" alt="">
</figure>
</div>
@@ -294,7 +294,7 @@
<div class="service-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917585/muglasurucukursu/araba1.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917585/muglasurucukursu/araba1.jpg" alt="">
</figure>
</a>
</div>
@@ -338,7 +338,7 @@
<div class="service-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917624/muglasurucukursu/arabasurus1.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917624/muglasurucukursu/arabasurus1.jpg" alt="">
</figure>
</a>
</div>
@@ -382,7 +382,7 @@
<div class="service-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917638/muglasurucukursu/motor4.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917638/muglasurucukursu/motor4.jpg" alt="">
</figure>
</a>
</div>
@@ -426,7 +426,7 @@
<div class="service-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917600/muglasurucukursu/arababakim5.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917600/muglasurucukursu/arababakim5.jpg" alt="">
</figure>
</a>
</div>
@@ -471,7 +471,7 @@
<div class="service-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917619/muglasurucukursu/arabaparkdikey.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917619/muglasurucukursu/arabaparkdikey.jpg" alt="">
</figure>
</a>
</div>
@@ -726,7 +726,7 @@
<div class="course-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917604/muglasurucukursu/arabadikey1.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917604/muglasurucukursu/arabadikey1.jpg" alt="">
</figure>
</a>
</div>
@@ -758,7 +758,7 @@
<div class="course-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917627/muglasurucukursu/motor.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917627/muglasurucukursu/motor.jpg" alt="">
</figure>
</a>
</div>
@@ -790,7 +790,7 @@
<div class="course-image">
<a href="contact.html" data-cursor-text="View">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917651/muglasurucukursu/tirdikey.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917651/muglasurucukursu/tirdikey.jpg" alt="">
</figure>
</a>
</div>
@@ -924,7 +924,7 @@
<!-- FAQ Image Start -->
<div class="faq-image wow fadeInUp" data-wow-delay="0.2s">
<figure class="image-anime">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917612/muglasurucukursu/arabagenel1.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917612/muglasurucukursu/arabagenel1.jpg" alt="">
</figure>
<!-- Appointment Info List Start -->
@@ -992,7 +992,7 @@
<!-- How It Work Image Start -->
<div class="how-it-work-image">
<figure class="image-anime reveal">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_800/v1777917643/muglasurucukursu/motorhoca.jpg" alt="">
<img loading="lazy" src="https://res.cloudinary.com/du7xohbct/image/upload/f_auto,q_auto,w_700/v1777917643/muglasurucukursu/motorhoca.jpg" alt="">
</figure>
</div>
<!-- How It Work Image End -->

View File

@@ -27,6 +27,8 @@ class Cursor {
}).on('mouseenter', () => {
self.show();
}).on('mousemove', (e) => {
if (this.lastMove && Date.now() - this.lastMove < 16) return; // Throttle to ~60fps
this.lastMove = Date.now();
this.pos = {
x: this.stick ? this.stick.x - ((this.stick.x - e.clientX) * 0.15) : e.clientX,
y: this.stick ? this.stick.y - ((this.stick.y - e.clientY) * 0.15) : e.clientY
@@ -95,33 +97,39 @@ class Cursor {
}
update() {
if (!this.visible) return;
this.move();
this.show();
}
move(x, y, duration) {
if (!this.el.length) return;
gsap.to(this.el, {
x: x || this.pos.x,
y: y || this.pos.y,
force3D: true,
overwrite: true,
overwrite: "auto",
ease: this.options.ease,
duration: this.visible ? (duration || this.options.speed) : 0
});
}
show() {
if (this.visible) return;
clearInterval(this.visibleInt);
if (this.visible || !this.el.length) return;
this.el.addClass('-visible');
this.visibleInt = setTimeout(() => this.visible = true);
this.visible = true;
}
hide() {
clearInterval(this.visibleInt);
if (!this.el.length) return;
this.el.removeClass('-visible');
this.visibleInt = setTimeout(() => this.visible = false, this.options.visibleTimeout);
this.visible = false;
}
}
// Init cursor
const cursor = new Cursor();
// Init cursor only on desktop and after load
$(window).on('load', function() {
if (window.innerWidth > 1024 && !('ontouchstart' in window)) {
const cursor = new Cursor();
}
});