Created
May 26, 2014 20:45
-
-
Save jamietotten/a25a6018a60766883bcb to your computer and use it in GitHub Desktop.
Reusable Tricks and Tips
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
// Makes all columns equal height | |
function fixColumns(wrapperClass, innerClass) { | |
$(wrapperClass).each(function () { | |
var maxHeight = 0; | |
$(this).find(innerClass).each(function () { | |
$(this).css('min-height', 0); | |
maxHeight = Math.max($(this).outerHeight(), maxHeight); | |
}) | |
$(this).find(innerClass).css('min-height', maxHeight+'px'); | |
}); | |
} | |
$(window).load(function() { | |
fixColumns('.field--home-featured-content','.main'); | |
}); | |
$(window).resize(function(){ | |
fixColumns('.field--home-featured-content','.main'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wrapperClass is the parent row class
innerClass is the element you want to make equal height.