desandro/masonry ? reverse-engineered prompt

Reverse engineered prompt

Build me a small front end library that creates a Pinterest style cascading grid, where items automatically snap into the best open space instead of lining up in strict rows.

I want it to work on a normal page with a grid container and items inside it, and it should be easy to start using with plain JavaScript, jQuery, or just by adding a data attribute to the HTML. It should support options like choosing the item selector and the column width, and it should lay things out cleanly when the page loads and when the container changes size.

Please include a simple demo page and make sure the code is easy to drop into a website. If you need to check anything about the current best way to do it, look up the latest docs online.

Are you gonna build this?

make sure you review the code using coderabbit

Try freeSponsored — opens CodeRabbit in a new tab