diff options
author | liabru <liambrum@gmail.com> | 2014-04-15 12:18:26 +0100 |
---|---|---|
committer | liabru <liambrum@gmail.com> | 2014-04-15 12:18:26 +0100 |
commit | 702eea61aa8976d09ef96d31d87ea64fec72bbd7 (patch) | |
tree | 18ef7f2eb98499b5d8ed97cf2185ef507a1bfc76 /jquery.matchHeight.js | |
parent | 18a6fa13affd913b6e281da3d0b698c189804b3e (diff) | |
download | jquery-match-height-702eea61aa8976d09ef96d31d87ea64fec72bbd7.zip jquery-match-height-702eea61aa8976d09ef96d31d87ea64fec72bbd7.tar.gz jquery-match-height-702eea61aa8976d09ef96d31d87ea64fec72bbd7.tar.bz2 |
fixed IE8 NaN bug when parsing 'auto' properties
Diffstat (limited to 'jquery.matchHeight.js')
-rw-r--r-- | jquery.matchHeight.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js index ccbbde4..337e412 100644 --- a/jquery.matchHeight.js +++ b/jquery.matchHeight.js @@ -79,8 +79,8 @@ // handle padding and border correctly (required when not using border-box) if ($that.css('box-sizing') !== 'border-box') { - verticalPadding += parseInt($that.css('border-top-width'), 10) + parseInt($that.css('border-bottom-width'), 10); - verticalPadding += parseInt($that.css('padding-top'), 10) + parseInt($that.css('padding-bottom'), 10); + verticalPadding += _parse($that.css('border-top-width')) + _parse($that.css('border-bottom-width')); + verticalPadding += _parse($that.css('padding-top')) + _parse($that.css('padding-bottom')); } // set the height (accounting for padding and border) @@ -153,7 +153,7 @@ // group elements by their top position $elements.each(function(){ var $that = $(this), - top = $that.offset().top - parseInt($that.css('margin-top'), 10), + top = $that.offset().top - _parse($that.css('margin-top')), lastRow = rows.length > 0 ? rows[rows.length - 1] : null; if (lastRow === null) { @@ -176,4 +176,9 @@ return rows; }; -})(jQuery); + var _parse = function(value) { + // parse value and convert NaN to 0 + return parseFloat(value) || 0; + }; + +})(jQuery);
\ No newline at end of file |