Skip to content

Instantly share code, notes, and snippets.

@rruhlen
Created September 29, 2016 00:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rruhlen/cc87b9390c0a488a7aba04aaaa1343a2 to your computer and use it in GitHub Desktop.
Save rruhlen/cc87b9390c0a488a7aba04aaaa1343a2 to your computer and use it in GitHub Desktop.
resize divs so they have the same height.
<script>
function adjustBoxes() {
$('.desk-topic').height("auto");
var elementHeights = $('.desk-topic').map(function() {
return $(this).outerHeight();
}).get();
var maxHeight = Math.max.apply(null, elementHeights);
$('.desk-topic').height(maxHeight);
}
$(function() {
$(window).on('resize', function(){
adjustBoxes();
});
adjustBoxes();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment