Skip to content

Instantly share code, notes, and snippets.

@rruhlen rruhlen/resize.js
Created Sep 29, 2016

Embed
What would you like to do?
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
You can’t perform that action at this time.