Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!