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>
  <a href="#" onclick="viewdiv();">Back</a>
  <div>
    <div class="i" id="d0"></div>
    <div class="i" id="d1"></div>
    <div class="i" id="d2"></div>
    <div class="i" id="d3"></div>
    <div class="i" id="d4"></div>
    <div class="i" id="d5"></div>
    <div class="i" id="d6"></div>
    <div class="i" id="d7"></div>
    <div class="i" id="d8"></div>
    <div class="i" id="d9"></div>
    <div class="i" id="d10"></div>
    <div class="i" id="d11"></div>
  </div>
  <a href="#">Next</a>
</body>
</html>
 
.i {
    width: 20px;
    height: 20px;
    background: red;
    margin-bottom: 5px;
}
 
var i = 0;
var id;
function viewdiv() {
  id = 'd'+i;
  var el = document.getElementById(id);
  
  if(el.offsetHeight) {
    if(i == 11) return;
    el.style.display = "none";
    i++;
  } 
}
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers