Hey akapowl first of all, thank you so much for your time! I can't tell you how grateful I am that actually somebody responds and that so fast. Thank you thank you!
I've tried to implement your suggestions and it did indeed change up somethings. I do have the feeling this is almost the solution. So if I understood you correctly and changed things accordingly, this should now work both ways? I actually got the scrolling to the point where it works on desktop and does not mess up mobile. But I have the feeling that something is still wrong with these scroller start & end markers. (or the orientation of my page). Because they are still over each other (screenshot) and animations don't work on mobile because the start and end never meet there, only on desktop if I don't use containerAnimation. That doesn't work on desktop either.
I've set the regular css code (mobile first page) like this:
body {
overscroll-behavior: none;
height: 100%;
width: 100%;
overflow-y: scroll;
overflow-x: hidden;
}
.container {
overscroll-behavior: none;
width: auto;
height: 100vh;
display: flex;
flex-wrap: nowrap;
overflow-y: hidden;
overflow-x: scroll;
}
And the media queries like this:
body {
overflow-y: hidden;
overflow-x: hidden;
}
.container {
overflow-y: hidden;
overflow-x: hidden;
}
And like this it feels good on desktop and doesn't mess up mobile.
But if I add my animation it only works on desktop because start and end markers are all on top of each other.
Oh and my animation works on desktop only if I remove the containerAnimation: scrollTween, maybe you also know what I did wrong there?
gsap.registerPlugin(ScrollTrigger);
let container = document.querySelector(".container");
let sections = gsap.utils.toArray(".panel");
let scrollTween = gsap.to(sections, {
xPercent: -100 * (sections.length - 1),
ease: "none",
scrollTrigger: {
trigger: ".container",
pin: true,
markers: true,
scrub: 1,
snap: 1 / (sections.length - 1),
end: () => "+=" + (container.scrollWidth - container.clientWidth),
}
});
gsap.to(".d-line-black",{
scrollTrigger: {
//should pin the animation to the timeline
containerAnimation: scrollTween,
trigger: "#navi",
markers: true,
toggleActions: "restart pause reverse pause",
start: "center left",
scrub: true,
},
y: 700,
duration: 3
})
Again thank you so much for your patience with my idiot code, I would love to pay you a dozen coffes at least for your help afterwards.
Best,
Manuel