Jump to content
Search Community

When using scrollWidth as value for scrollTrigger, it doesn't count for element's padding

kohlej test
Moderator Tag

Recommended Posts

 

Hey @kohlej

 

I'm pretty sure, ScrollTrigger is interpreting things correctly there.

Your problem is more CSS-layout related.

 

You can see that when you comment out all your JS and remove the overflow-x: hidden from your roller, that things are not set up the way you might think in the first place. So you might want to tweek your setup so it displays as wanted first before hooking it up to ScrollTrigger.

 

See the Pen cd0294f560181f28090532d7ea106fdd by akapowl (@akapowl) on CodePen

 

  • Like 1
Link to comment
Share on other sites

6 minutes ago, akapowl said:

 

Hey @kohlej

 

I'm pretty sure, ScrollTrigger is interpreting things correctly there.

Your problem is more CSS-layout related.

 

You can see that when you comment out all your JS and remove the overflow-x: hidden from your roller, that things are not set up the way you might think in the first place. So you might want to tweek your setup so it displays as wanted first before hooking it up to ScrollTrigger.

 

 

 

 

I thought that might be the case, but then it weirded me out that it actually almost does the right thing. I know that .roller__inner isnt taking the width of child elements, but of my viewport width, but why does it even scroll then?

I will look into it and update here

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...