-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 1px column gaps. Use percent values in internally #795
Comments
Thank you for this feedback! This is an interesting idea. Internally, Masonry has always used pixels for its measurement of items and column sizes. The Using percent values internally could resolve the 1 pixel gaps, but it would require re-tooling a fair amount of code to do so. I'm open to the idea, but I'd like to think on it for a bit. |
Yes, maybe that’s an even better point, to calculate in percentages internally – that would be more like a strategy, other than the ~fix I suggested earlier … |
Hey there. This is a repost from the incorrectly posted First of all, thanks for this great library! It works perfectly except for this very tiny little issue. I'm using Here's the screenshot So how can we help you with this? |
I had the same problem with my image gallery. The solution, as explained in this page, is to change the container width (a little bit less than 100%) and increase the column width. |
Obnoxious issue... did anyone find a workaround? |
There's the seamless Masonry via Beyoncé's tumblr solution |
See here: https://codepen.io/desandro/pen/myBxD This still shows issues. Some images overlap others by 1 pixel. |
I have found a nice fix for this issue. Works 100% in all browsers. I will push it tonight :) |
@hasinhayder where is the fix? :) |
@hasinhayder please share your fix. This is driving me nuts 😞 |
@tonytone999, @zamson @tiagogon - the problem occurs because of using if you are using the masonry.pkgd.js or masonry.pkgd.min.js or packery.pkgd.js or packery.pkgd.min.js packaged version (minified or not minified), the quickest fix is to open your js file and replace all |
@hasinhayder it's working! how come this is not updated in the plugin? any drawbacks? |
@zamson no drawbacks buddy :) |
Outlayer v2.1.1 was released last year, which uses float values. I'll be updating Masonry with this change in its next release. |
@desandro good to see that it's finally happening. Please also update packery as well :) |
I managed to solve it by adding specific selectors to some containers that overlap or miss 1 pixel due to calculation error. Sometimes I had to use browser specific selectors (media queries that target specific browsers). Good to know it's solved. @desandro you rock, man, awesome work. |
⬆️ update dependencies + outlayer v2.1.1. #795 + fizzy-ui-utils v2.0.7 + get-size v2.0.3
Outlayer v2.1.1 has been added to masonry.pkgd.js in Masonry v4.2.2 |
Hi,
I’m not sure, but I don’t understand the way the left position is calculated on layouts based on percentage widths.
That even doesn’t work correctly in the example provided on your webpage: [http://codepen.io/desandro/pen/JFpeg]
→ I’m not a genius on maths … but, I thought that the second column should always start at 20% instead.
This uneven percentages lead to 1px flashing gutters, depending on the size of the container.
MacOSX; Safari, Chrome, Firefox …
To me, this looks like the script re-calulates to percent, what the browser formerly calculated in pixels from the percentages provided by CSS, like:
css/percentage → browser/pixel → script/percentage
I’m aware that it’s not always possible to count with even pixels on fluid layouts: you simply can’t divide 981 pixels by 5 columns with non-comma-pixel-widths.
But, that’s what the percentage values are for. They tell the browser "that’s your job". And the browsers are able to dived the space in columns. And when I set the left values to 20% (40%, 60%, 80%) in the WebInspector, there are no flashing gutters.
→ Wouldn’t it be better to get/read the CSS width percentage value of the itemSelector element, to directly and exactly set the left value of the next item …?
[ left: 0; width: 20% ][ left: 20%; width: 40% ][ left: 60%; width: 20% ] …
The text was updated successfully, but these errors were encountered: