Skip to content

Instantly share code, notes, and snippets.

@dibakarjana
Last active December 18, 2015 23:28
Show Gist options
  • Save dibakarjana/5861327 to your computer and use it in GitHub Desktop.
Save dibakarjana/5861327 to your computer and use it in GitHub Desktop.
jQuery Variable Height
<html>
<head>
<meta charset="UTF-8">
<title>jQuery Variable Height</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<body>
<div id="col1"></div>
<div id="col2"></div>
<div id="sidebar">asdsd <br>asdasd</div>
</body>
</html>
$(document).ready(function(){
var sideheightnew = $('#sidebar').height();
$('#col1').animate({height : sideheightnew});
$('#col2').animate({height : sideheightnew});
});
#col1{
width:200px;
height:200px;
float:left;
background:#8cac50;
margin-right:10px;
}
#col2{
width:200px;
height:1px;
float:left;
margin-right:10px;
background:#8cac50;
}
#sidebar{
width:200px;
height:100px;
float:left;
margin-right:10px;
background:#2ec8f0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment