Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

152
Visualizações
gsap scroll trigger horizontal scroll problem on touchscreen devices

I have a problem with horizontal scroll, everything works fine on the desktop, problem appears on devices with touchscreen (try devtools in responsive mode). the page starts scrolling vertically and there is a problem of strange arrangement of sections on the page. Link to the page (open dev tools and check responsive mode) https://thebar.testuj.org.pl/ My scroll trigger code:

export default function Fullpage() {
   gsap.registerPlugin(ScrollTrigger);

   useEffect(() => {
      const sections = gsap.utils.toArray(".slide");
      let maxWidth = 0;

      const getMaxWidth = () => {
         maxWidth = 0;
         sections.forEach((section) => {
            maxWidth += section.offsetWidth;
         });
      };

      getMaxWidth();

      ScrollTrigger.addEventListener("refreshInit", getMaxWidth);

      gsap.to(sections, {
         x: () => `-${maxWidth - window.innerWidth}`,
         ease: "none",
         scrollTrigger: {
            trigger: ".parent",
            pin: true,
            scrub: true,
            end: () => `+=${maxWidth}`,
            invalidateOnRefresh: true,
            autoRefreshEvents: "visibilitychange,DOMContentLoaded,load"
         },
      });

   });
   return (
      <div className="parent flex flex-nowrap">
         <First />
         <Second />
         <Third />
         <Fourth />
         <Fifth />

         <Sixth />
         <Seventh />
         <Eighth />
         <Ninth />
         <Tenth />
         <Eleventh />
        
      </div>
   );
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda