Merge branch 'mai/hermes/issue-7-smartin3-de': smartin3.de Mobile-Scroll-Fix (#7)

This commit is contained in:
mAi
2026-04-27 20:08:42 +02:00

View File

@@ -94,6 +94,9 @@
display: flex; justify-content: center;
padding: 60px 40px;
}
@media (max-width: 768px) {
.text3d-wrapper { touch-action: pan-y; }
}
.text3d {
transform-style: preserve-3d;
@@ -670,8 +673,9 @@
// Interactive 3D text
(function() {
var hero = document.querySelector('.hero');
var wrapper = document.querySelector('.text3d-wrapper');
var text = document.querySelector('.text3d');
if (!hero || !text) return;
if (!hero || !wrapper || !text) return;
function handleMove(x, y) {
var w = window.innerWidth;
@@ -684,10 +688,16 @@
}
hero.addEventListener('mousemove', function(e) { handleMove(e.clientX, e.clientY); });
hero.addEventListener('touchmove', function(e) {
e.preventDefault();
handleMove(e.touches[0].clientX, e.touches[0].clientY);
}, {passive: false});
if (window.matchMedia('(max-width: 768px)').matches) {
wrapper.addEventListener('touchmove', function(e) {
handleMove(e.touches[0].clientX, e.touches[0].clientY);
}, {passive: true});
} else {
hero.addEventListener('touchmove', function(e) {
e.preventDefault();
handleMove(e.touches[0].clientX, e.touches[0].clientY);
}, {passive: false});
}
hero.addEventListener('mouseleave', function() {
text.style.animation = '';
text.style.transform = '';