summaryrefslogtreecommitdiffstats
path: root/jquery.matchHeight.js
diff options
context:
space:
mode:
authorliabru <liabru@brm.io>2014-09-17 00:47:24 +0100
committerliabru <liabru@brm.io>2014-09-17 00:47:24 +0100
commit71a51511b7afa3ba016d908b330751b2b522c123 (patch)
tree787d326c7ab6aac0535c2cf3519c11a8c698a72b /jquery.matchHeight.js
parent56214a1cbfb90181355343500b545b480ebe51f1 (diff)
downloadjquery-match-height-71a51511b7afa3ba016d908b330751b2b522c123.zip
jquery-match-height-71a51511b7afa3ba016d908b330751b2b522c123.tar.gz
jquery-match-height-71a51511b7afa3ba016d908b330751b2b522c123.tar.bz2
fix handling of hidden elements by row, closes #28
Diffstat (limited to 'jquery.matchHeight.js')
-rw-r--r--jquery.matchHeight.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js
index fb3411e..004b10a 100644
--- a/jquery.matchHeight.js
+++ b/jquery.matchHeight.js
@@ -123,6 +123,10 @@
var scrollTop = $(window).scrollTop(),
htmlHeight = $('html').outerHeight(true);
+ // temporarily must force hidden parents visible
+ var $hiddenParents = $elements.parents().filter(':hidden');
+ $hiddenParents.css('display', 'block');
+
// get rows if using byRow, otherwise assume one row
if (byRow) {
@@ -164,10 +168,6 @@
if (byRow && $row.length <= 1)
return;
- // ensure elements are visible to prevent 0 height
- var hiddenParents = $row.parents().add($row).filter(':hidden');
- hiddenParents.css({ 'display': 'block' });
-
// iterate the row and find the max height
$row.each(function(){
var $that = $(this),
@@ -181,12 +181,9 @@
maxHeight = $that.outerHeight(false);
// revert display block
- $that.css({ 'display': '' });
+ $that.css('display', '');
});
- // revert display block
- hiddenParents.css({ 'display': '' });
-
// iterate the row and apply the height to all elements
$row.each(function(){
var $that = $(this),
@@ -203,6 +200,9 @@
});
});
+ // revert hidden parents
+ $hiddenParents.css('display', '');
+
// restore scroll position if enabled
if ($.fn.matchHeight._maintainScroll)
$(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));