Jump to content
Search Community

horizontalLoop() with variable width

Thomas Günther test
Moderator Tag

Go to solution Solved by mvaneijgen,

Recommended Posts

Hey there 👋

 

I'm currently using the great horizontalLoop() helper function in a project. It worked great until I introduced different/variable widths. Now it seems like the gap between the elements is not calculated correctly anymore. I've also attached a screenshot of the different gaps.

 

To be honest I don't understand 100% of what's going on in the helper function. Is it even possible to use it with variable widths? I've found tons of threads in the forums but none of them have variable widths.

 

Thanks for a nudge in the right direction,
Thomas

 

image.thumb.png.e0fad8ffa0b81f83d94c28dc0f035db4.png

See the Pen BaVzYNE by medienbaecker (@medienbaecker) on CodePen

Link to comment
Share on other sites

  • Thomas Günther changed the title to horizontalLoop() with variable width
  • Solution

Just guessing, maybe something with box-sizing. Is there a Flex gap box-sizing property that also calculates the gap? The function states it uses  xPercent and if the gap isn't included in that you would get weird results 

 

Here is an example with padding-left, I'm scared to say it, but it looks ok ... 😱   

See the Pen GRGqxNp by mvaneijgen (@mvaneijgen) on CodePen

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