Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular-route.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
    <div class="divBottom" id="divBottom" onclick="divOpen()"></div>
</body>
</html>
 
div {
  border:solid 1px red; 
  width:200px;
  height:20px;   
}
.divBottom {
  bottom: 0;
  right: 20px;
  cursor: pointer;
}
 
function divOpen() {
  var divHeight= document.getElementById("divBottom").offsetHeight;
  console.log(divHeight);
  //22 because of the border
  if (divHeight == 22) {
    document.getElementById("divBottom").style.height="200px"; 
  }
  else {
    document.getElementById("divBottom").style.height="20px"; 
  }
}
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers