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