on-internet
← Community

Responsive Masonry layout without predefined widths

Stack Overflow ·

I'm creating a 2 column masonry layout using images of different sizes. The images can be any size as long as they have the greatest common divisor (as required by the Masonry plugin). In order to make the layout responsive I'm converting the width of the masonry items into percent (or I can use min-width and width 100%). Update: I noticed that many who answer make both columns 50% as a solution. That works but is not the goal. Images have to retain their original image size. They can shrink but keep the same ratio. $(function () { var container = $('#container'); // Convert .box width from pi

Comments

Sign in or sign up to comment and upvote.

No comments yet.