Created
September 29, 2016 00:34
-
-
Save rruhlen/cc87b9390c0a488a7aba04aaaa1343a2 to your computer and use it in GitHub Desktop.
resize divs so they have the same height.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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