Created
July 20, 2010 20:33
-
-
Save davist11/483530 to your computer and use it in GitHub Desktop.
Equal heights plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;(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