mirror of
https://github.com/Expand-sys/whoscatrevival
synced 2026-03-22 17:57:08 +11:00
9 lines
357 B
JavaScript
9 lines
357 B
JavaScript
const numCols = 3;
|
|
const colHeights = Array(numCols).fill(0);
|
|
const container = document.getElementById('masonry-with-columns');
|
|
Array.from(container.children).forEach((child, i) => {
|
|
const order = i % numCols;
|
|
child.style.order = order;
|
|
colHeights[order] += parseFloat(child.clientHeight);
|
|
})
|
|
container.style.height = Math.max(...colHeights) + 'px';
|