Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <wrapper>
    <container>
      <column>1</column>
    </container>
  </wrapper>
</body>
</html>
 
wrapper {
  overflow: hidden;
  width: 250px;
}
container {
  display: flex;
  flex-wrap: wrap;
  margin: -25px;
}
column {
  flex: 0 1 50px;
}
/* demo styles */
wrapper {
  display: block;
  font-family: sans-serif;
  outline: 2px solid navy;
}
column {
  line-height: 50px;
  margin: 25px;
  color: white;
  text-align: center;
  background: tomato;
}
 
var container = document.querySelector('container');
var max = 9;
var count = 0;
var dir = 1;
function updateCount() {
  if (count === max && dir === 1) {
    dir = -1;
    return;
  }
  if (count === 1 && dir === -1) {
    dir = 1;
    return;
  }
  count += dir;
}
function draw() {
  var html = '';
  for (var i = 0; i < count; i++) {
    html += '<column>'+(i+1)+'</column>';
  }
  container.innerHTML = html;
}
function anim() {
  updateCount();
  draw();
  setTimeout(anim, 300);
}
anim();
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
bpierrepro
0viewers