Skip to content

Instantly share code, notes, and snippets.

@jamietotten
Created May 26, 2014 20:45
Show Gist options
  • Save jamietotten/a25a6018a60766883bcb to your computer and use it in GitHub Desktop.
Save jamietotten/a25a6018a60766883bcb to your computer and use it in GitHub Desktop.
Reusable Tricks and Tips
// 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');
});
@helloimbenny
Copy link

wrapperClass is the parent row class
innerClass is the element you want to make equal height.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment