Skip to content

Instantly share code, notes, and snippets.

@jeremyzahner
Created October 16, 2014 14:54
Show Gist options
  • Save jeremyzahner/b383d9991bc37f6a0728 to your computer and use it in GitHub Desktop.
Save jeremyzahner/b383d9991bc37f6a0728 to your computer and use it in GitHub Desktop.
Function to equalize the height of elements (i.E. inside a Grid) with jQuery.
// This function knowingly also invokes the parent element, so if some changes need to be done to that its already there.
var sameheights = function (parent_item_object,child_item_cssstring){
var heights = [];
parent_item_object.each(function(e){
heights.push( $(this).children(child_item_cssstring).height() );
});
parent_item_object.each(function(e){
$(this).children(child_item_cssstring).css('min-height', Math.max.apply(Math, heights));
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment