Skip to content

Instantly share code, notes, and snippets.

@timstl
Last active August 17, 2016 15:45
Show Gist options
  • Save timstl/6124173 to your computer and use it in GitHub Desktop.
Save timstl/6124173 to your computer and use it in GitHub Desktop.
jQuery plugin to equalize height of a set of elements if you can't do so via CSS for whatever reason.
/*
Column Equalize
Example: $('.col-equalize .col').colequalize();
*/
;(function($) {
$.fn.colequalize = function(options) {
var h = 0;
this.each(function() {
var $this = $(this),
thish = parseFloat($this.height());
if (thish > h) { h = thish; }
});
if (h > 0) { this.height(h); }
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment