Jump to content
Search Community

ScrollTrigger issue on mobile in react

wtartlez test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello there,

I created some scrolling animations with ScrollTrigger in a react app, while it works fine on desktop and mobile emulation in the DevTools, the animation won't play at all when viewing the page on a mobile device. Another thing I noticed is that the markers are kinda messed up, but the animation still works on desktop after turning the markers off.

Here's the minimal demo on codepen. I've tried googling with keywords like "scrollTrigger not working on mobile" but couldn't find anything that seemed related to my problem. Still learning react and GSAP, so maybe I missed something there. Would really appreciate for any help!

See the Pen wvbPVXv by tartle120 (@tartle120) on CodePen

Link to comment
Share on other sites

  • Solution

Notice you've actually got TWO scrollbars on the right side. This looks like a CSS issue in the way you set it up. Just remove the overflow-x: hidden from the html element. 

body { /* NOT html, body */
  font-family: "Rock Salt", cursive;
  width: 100%;
  height: 100%;
  color: #fff;
  overflow-x: hidden;
}

Does that clear things up? Basically, your scroller wasn't what you thought it was. 

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...