example/modules/Nav.js
function split(arr, size) {
  var out = [];
  var sizes = [];
  var where = size - 1;
  var ptr = 0;
  var i, j;

  for (i = arr.length - 1; i >= 0; i--) {
    sizes[where] = (sizes[where] || 0) + 1;
    if (--where === -1) where = size - 1;
  }

  for (i = 0; i < size; i++) {
    for (j = 0; j < sizes[i]; j++) {
      if (j === 0) out[i] = [arr[ptr]];
      else out[i].push(arr[ptr]);
      ptr++;
    }
  }

  return out;
}
function split(arr, size) {
  var out = [];
  var sizes = [];
  var where = size - 1;
  var ptr = 0;
  var i, j;

  for (i = arr.length - 1; i >= 0; i--) {
    sizes[where] = (sizes[where] || 0) + 1;
    if (--where === -1) where = size - 1;
  }

  for (i = 0; i < size; i++) {
    for (j = 0; j < sizes[i]; j++) {
      if (j === 0) out[i] = [arr[ptr]];
      else out[i].push(arr[ptr]);
      ptr++;
    }
  }

  return out;
}
function split ( arr , size ) { var out = [ ] ; var sizes = [ ] ; var where = size - 1 ; var ptr = 0 ; var i , j ; for ( i = arr . length - 1 ; i >= 0 ; i -- ) { sizes [ where ] = ( sizes [ where ] || 0 ) + 1 ; if ( -- where === - 1 ) where = size - 1 ; } for ( i = 0 ; i < size ; i ++ ) { for ( j = 0 ; j < sizes [ i ] ; j ++ ) { if ( j === 0 ) out [ i ] = [ arr [ ptr ] ] ; else out [ i ] . push ( arr [ ptr ] ) ; ptr ++ ; } } return out ; }
A function to arrange the buttons into a certain number of rows no matter the number
A function to arrange the buttons into a certain number of rows no matter the number