diff options
Diffstat (limited to 'jquery.matchHeight.js')
-rw-r--r-- | jquery.matchHeight.js | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js index 367df93..713f70f 100644 --- a/jquery.matchHeight.js +++ b/jquery.matchHeight.js @@ -51,13 +51,18 @@ if (byRow) { // must first force an arbitrary equal height so floating elements break evenly - $elements.css({ - 'display': 'block', - 'padding-top': '0', - 'padding-bottom': '0', - 'border-top-width': '0', - 'border-bottom-width': '0', - 'height': '100px' + $elements.each(function() { + var $that = $(this), + display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; + + $that.css({ + 'display': display, + 'padding-top': '0', + 'padding-bottom': '0', + 'border-top-width': '0', + 'border-bottom-width': '0', + 'height': '100px' + }); }); // get the array of rows (based on element top position) @@ -84,10 +89,11 @@ // iterate the row and find the max height $row.each(function(){ - var $that = $(this); + var $that = $(this), + display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; // ensure we get the correct actual height (and not a previously set height value) - $that.css({ 'display': 'block', 'height': '' }); + $that.css({ 'display': display, 'height': '' }); // find the max height (including padding, but not margin) if ($that.outerHeight(false) > maxHeight) |