src/lib/demo.js
function(cells, reflow) {
    var columnIndex;
    var columnHeight;
    for(var j = 0, k = cells.length; j < k; j++) {
      // Place the cell to column with the minimal height.
      columnIndex = getMinKey(columnHeights);
      columnHeight = columnHeights[columnIndex];
      cells[j].style.height = (cells[j].offsetHeight - CELL_PADDING) + 'px';
      cells[j].style.left = columnIndex * (COLUMN_WIDTH + GAP_WIDTH) + 'px';
      cells[j].style.top = columnHeight + 'px';
      columnHeights[columnIndex] = columnHeight + GAP_HEIGHT + cells[j].offsetHeight;
      if(!reflow) {
        cells[j].className = 'cell ready';
      }
    }
    cellsContainer.style.height = getMaxVal(columnHeights) + 'px';
    manageCells();
  }
function(cells, reflow) {
    var columnIndex;
    var columnHeight;
    for(var j = 0, k = cells.length; j < k; j++) {
      // Place the cell to column with the minimal height.
      columnIndex = getMinKey(columnHeights);
      columnHeight = columnHeights[columnIndex];
      cells[j].style.height = (cells[j].offsetHeight - CELL_PADDING) + 'px';
      cells[j].style.left = columnIndex * (COLUMN_WIDTH + GAP_WIDTH) + 'px';
      cells[j].style.top = columnHeight + 'px';
      columnHeights[columnIndex] = columnHeight + GAP_HEIGHT + cells[j].offsetHeight;
      if(!reflow) {
        cells[j].className = 'cell ready';
      }
    }
    cellsContainer.style.height = getMaxVal(columnHeights) + 'px';
    manageCells();
  }
function ( cells , reflow ) { var columnIndex ; var columnHeight ; for ( var j = 0 , k = cells . length ; j < k ; j ++ ) { // Place the cell to column with the minimal height. columnIndex = getMinKey ( columnHeights ) ; columnHeight = columnHeights [ columnIndex ] ; cells [ j ] . style . height = ( cells [ j ] . offsetHeight - CELL_PADDING ) + 'px' ; cells [ j ] . style . left = columnIndex * ( COLUMN_WIDTH + GAP_WIDTH ) + 'px' ; cells [ j ] . style . top = columnHeight + 'px' ; columnHeights [ columnIndex ] = columnHeight + GAP_HEIGHT + cells [ j ] . offsetHeight ; if ( ! reflow ) { cells [ j ] . className = 'cell ready' ; } } cellsContainer . style . height = getMaxVal ( columnHeights ) + 'px' ; manageCells ( ) ; }
Position the newly appended cells and update array of column heights.
Position the newly appended cells and update array of column heights .