summaryrefslogtreecommitdiffstats
path: root/jquery.matchHeight.js
diff options
context:
space:
mode:
authorNikolay Yordanov <me@nyordanov.com>2014-09-13 17:46:26 +0100
committerNikolay Yordanov <me@nyordanov.com>2014-09-13 17:46:26 +0100
commit72ba5cf567997623ffb623f69f1eeca6b7d5739c (patch)
treedbbddfd85edb0244f1789c01906cc9f8ecba2581 /jquery.matchHeight.js
parentfdc8f7ab7e37343c0d62e4e3d58912649e39add8 (diff)
downloadjquery-match-height-72ba5cf567997623ffb623f69f1eeca6b7d5739c.zip
jquery-match-height-72ba5cf567997623ffb623f69f1eeca6b7d5739c.tar.gz
jquery-match-height-72ba5cf567997623ffb623f69f1eeca6b7d5739c.tar.bz2
Preserve inline styles when using byRow
Diffstat (limited to 'jquery.matchHeight.js')
-rw-r--r--jquery.matchHeight.js32
1 files changed, 14 insertions, 18 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js
index 39ce311..671b436 100644
--- a/jquery.matchHeight.js
+++ b/jquery.matchHeight.js
@@ -13,8 +13,8 @@
_updateTimeout = -1;
/*
- * _rows
- * utility function returns array of jQuery selections representing each row
+ * _rows
+ * utility function returns array of jQuery selections representing each row
* (as displayed after float wrapping applied by browser)
*/
@@ -131,7 +131,7 @@
var $that = $(this),
display = $that.css('display') === 'inline-block' ? 'inline-block' : 'block';
- $that.css({
+ $that.data('original_style', $that.attr('style')).css({
'display': display,
'padding-top': '0',
'padding-bottom': '0',
@@ -144,14 +144,10 @@
// get the array of rows (based on element top position)
rows = _rows($elements);
- // revert the temporary forced style
- $elements.css({
- 'display': '',
- 'padding-top': '',
- 'padding-bottom': '',
- 'border-top-width': '',
- 'border-bottom-width': '',
- 'height': ''
+ $elements.each(function() {
+ var $that = $(this);
+
+ $that.attr('style', $that.data('original_style'));
});
}
@@ -213,7 +209,7 @@
* $.fn.matchHeight._applyDataApi
* applies matchHeight to all elements with a data-match-height attribute
*/
-
+
$.fn.matchHeight._applyDataApi = function() {
var groups = {};
@@ -234,7 +230,7 @@
});
};
- /*
+ /*
* $.fn.matchHeight._update
* updates matchHeight on all current groups with their correct options
*/
@@ -246,7 +242,7 @@
};
$.fn.matchHeight._update = function(throttle, event) {
- // prevent update if fired from a resize event
+ // prevent update if fired from a resize event
// where the viewport width hasn't actually changed
// fixes an event looping bug in IE8
if (event && event.type === 'resize') {
@@ -267,7 +263,7 @@
}
};
- /*
+ /*
* bind events
*/
@@ -275,13 +271,13 @@
$($.fn.matchHeight._applyDataApi);
// update heights on load and resize events
- $(window).bind('load', function(event) {
+ $(window).bind('load', function(event) {
$.fn.matchHeight._update();
});
// throttled update heights on resize events
- $(window).bind('resize orientationchange', function(event) {
+ $(window).bind('resize orientationchange', function(event) {
$.fn.matchHeight._update(true, event);
});
-})(jQuery); \ No newline at end of file
+})(jQuery);