Skip to content

Instantly share code, notes, and snippets.

@rob-bar
Created April 9, 2014 15:29
Show Gist options
  • Save rob-bar/10283279 to your computer and use it in GitHub Desktop.
Save rob-bar/10283279 to your computer and use it in GitHub Desktop.
equal heights
var helper = {
highest: function(selector) {
return Math.max.apply(this || window, selector.map(function() {
return $(this).innerHeight();
}));
},
equalheights: function(selector, highest) {
return selector.each(function() {
return $(this).css("height", "" + highest + "px");
});
}
};
var fixheightsof = $("#left, #right");
helper.equalheights(fixheightsof, helper.highest(fixheightsof));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment