Jump to content
Search Community

ScrollTrigger Horizontal scroll not working in Mobile devices (Small screens)

Atharv varshney test
Moderator Tag

Go to solution Solved by Rodrigo,

Recommended Posts

Hey, what's up?

 

I have created a website https://jimny.vercel.app/ where I used a ton of ScrollTrigger animations. All went perfectly, this forum helped me a lot. 

I have encountered a problem which is very common among the people in this forum. The horizontal pinned scroll created using ScrollTrigger is overflowing the viewport width in small (mobile) devices. What I want is obviously, the scrolling section should not overflow the width.

I have tried adding a media query where I set the width of wrapper div as 100vw and overflow-x  as hidden, but still it didn't worked. I have added a codepen, Please help me fix it. I really appreciate your suggestions.

Thanks a lot,

Atharv varshney

See the Pen jOQEGZM by Atharvvarshney (@Atharvvarshney) on CodePen

Link to comment
Share on other sites

  • Solution

Hi,

 

I just wrapped that section around an element with overflow hidden and it seems to work as expected on my devices:

See the Pen YzRPrdb by GreenSock (@GreenSock) on CodePen

 

Here is the example without iframes:

https://cdpn.io/pen/debug/YzRPrdb

 

Finally the box-sizing property, ideally should be global and not just applied to the body element:

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

Hopefully this helps.

Happy Tweening!

  • Thanks 1
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...