Skip to content

Instantly share code, notes, and snippets.

@DeskWOW
Created January 16, 2014 05:31
Show Gist options
  • Save DeskWOW/8450289 to your computer and use it in GitHub Desktop.
Save DeskWOW/8450289 to your computer and use it in GitHub Desktop.
when you need to have the same height for 2 divs and one div has dynamic content, just add a simultaneously class to each div and the shorter div increases in height to match the larger div.
<script type="text/javascript">
$(document).ready(function(){
var maxHeight = 0;
$('div.simultaneously').each(function(index){
if ($(this).height() > maxHeight)
{
maxHeight = $(this).height();
}
});
$('div.simultaneously').height(maxHeight);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment