diff options
author | liabru <liabru@brm.io> | 2014-09-16 23:44:14 +0100 |
---|---|---|
committer | liabru <liabru@brm.io> | 2014-09-16 23:44:14 +0100 |
commit | e9de70270c521a10207e22934e31151ba08461dc (patch) | |
tree | 60e2dc78660e374892b74b59bff0ca5c8215a1a7 | |
parent | 72ba5cf567997623ffb623f69f1eeca6b7d5739c (diff) | |
download | jquery-match-height-e9de70270c521a10207e22934e31151ba08461dc.zip jquery-match-height-e9de70270c521a10207e22934e31151ba08461dc.tar.gz jquery-match-height-e9de70270c521a10207e22934e31151ba08461dc.tar.bz2 |
fix to preserve inline styles
-rw-r--r-- | jquery.matchHeight.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js index 671b436..fb3411e 100644 --- a/jquery.matchHeight.js +++ b/jquery.matchHeight.js @@ -131,7 +131,10 @@ var $that = $(this), display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block'; - $that.data('original_style', $that.attr('style')).css({ + // cache the original inline style + $that.data('style-cache', $that.attr('style')); + + $that.css({ 'display': display, 'padding-top': '0', 'padding-bottom': '0', @@ -144,10 +147,12 @@ // get the array of rows (based on element top position) rows = _rows($elements); + // revert original inline styles $elements.each(function() { var $that = $(this); - $that.attr('style', $that.data('original_style')); + $that.attr('style', $that.data('style-cache') || '') + .css('height', ''); }); } |