Skip to content

Instantly share code, notes, and snippets.

@davist11
Created July 20, 2010 20:33
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davist11/483530 to your computer and use it in GitHub Desktop.
Save davist11/483530 to your computer and use it in GitHub Desktop.
Equal heights plugin
;(function($) {
// Equal height items
$.fn.equalHeight = function(options) {
var opts = $.extend({}, $.fn.equalHeight.defaults, options);
return this.each(function() {
var $this = $(this),
o = $.meta ? $.extend({}, opts, $this.data()) : opts,
maxHeight = 0;
$this.find(o.find).each(function() {
var elemHeight = $(this).height();
maxHeight = (elemHeight > maxHeight) ? elemHeight : maxHeight;
}).height(maxHeight);
});
};
// default options
$.fn.equalHeight.defaults = {
find: 'li'
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment