flickr / justified-layout

Pass in box sizes and get back sizes and coordinates for a justified layout
https://flickr.github.io/justified-layout/
MIT License
1.6k stars 87 forks source link

How to add content to the layout #19

Closed Leo-lin214 closed 8 years ago

Leo-lin214 commented 8 years ago

The justified layout is great, but I don't know how to add content to the layout and can you give an example?

jimwhimpey commented 8 years ago

The [demo page]() uses the returned geometry to render boxes.

Here's the crux of the code:

var geometry = justifiedLayout(input, config);
var boxes = geometry.boxes.map(function (box) {
   return  `<div class="box" style="width: ${box.width}px; height: ${box.height}px; top: ${box.top}px; left: ${box.left}px"></div>`;
}).join('\n');
englishextra commented 5 years ago

@jimwhimpey Why not put that sample in README.md ?