Last active
December 13, 2016 15:53
-
-
Save JKirchartz/83b29ba21a8b39df4146db28eb8ac0b3 to your computer and use it in GitHub Desktop.
If I have to write bad code to get the "right" design, so be it, but at least I can keep it D.R.Y. -- This snippet listens to window sizing commands, internally the sameHeight functions take a container class and a child's class, find the tallest child, then makes all that containers children the same height -- this is only for when CSS's `flexb…
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
$(window).resize(function(){ | |
function sameHeight(container, child) { | |
$(container).each(function(){ | |
var tallest = 0; | |
$(child, this).each(function(){ | |
if($(this).height() > tallest) { | |
tallest = $(this).height(); | |
} | |
}); | |
$(child, this).height(tallest); | |
}); | |
} | |
sameHeight('.callout.cost', '.cost-box'); | |
sameHeight('.callout.give', '.give-box'); | |
}).resize(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment