Skip to content

Instantly share code, notes, and snippets.

@andreaseger
Created July 30, 2013 07:09
Show Gist options
  • Save andreaseger/6110893 to your computer and use it in GitHub Desktop.
Save andreaseger/6110893 to your computer and use it in GitHub Desktop.
// uses underscore.js stuff
E.Helpers.Html = {
equalHeights: function($el, minHeight, maxHeight) {
var heights,targetHeight;
heights = jQuery($el).map(function(){return jQuery(this).height();});
heights.push(minHeight);
targetHeight = maxHeight ? _.min([maxHeight, _.max(heights)]) : _.max(heights);
return jQuery($el).each(function(){
jQuery(this).height(targetHeight).css("overflow","auto");
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment