diff options
author | liabru <liabru@brm.io> | 2014-08-03 13:58:05 +0100 |
---|---|---|
committer | liabru <liabru@brm.io> | 2014-08-03 13:58:05 +0100 |
commit | b3df801b4144b295ee4eeb42ae10c45dc5b958d6 (patch) | |
tree | 78767e2ae2df60ad8954493807ac18f8f1bda1a1 /jquery.matchHeight.js | |
parent | 5dafa0c7b5aab768dd17f312b766b1d55aadf06a (diff) | |
download | jquery-match-height-b3df801b4144b295ee4eeb42ae10c45dc5b958d6.zip jquery-match-height-b3df801b4144b295ee4eeb42ae10c45dc5b958d6.tar.gz jquery-match-height-b3df801b4144b295ee4eeb42ae10c45dc5b958d6.tar.bz2 |
fixed support for inline-block
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) |