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>
  <div id="flex">
    <p>foo</p>
    
    <!-- add extra "<p>foo</p>" here. -->
  </div>
</body>
</html>
 
#flex {
  display: flex;
  flex-flow: column wrap;
  outline: 1px solid black;
  padding: 3px;
  max-height: 100%;
  width: 150px;
  overflow: auto;
  align-content: flex-start;
}
p {
  margin: 0;
  outline: 1px solid black;
  padding: 3px 3px;
  align-self: flex-start
}
body {
  height: 150px;
  width: 300px;
  outline: 1px dashed black
}
 
var ascending = true;
setInterval(function() {
  var parent = document.getElementById('flex');
  if (ascending) {
    var child = document.createElement('p');
    child.innerHTML = "foo";
    parent.appendChild(child);
  } else {
    parent.removeChild(parent.children[0]);
  }
  if (parent.children.length <= 1) ascending = true;
  if (parent.children.length >= 40) ascending = false;
}, 200);
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers