summaryrefslogtreecommitdiffstats
path: root/jquery.matchHeight.js
diff options
context:
space:
mode:
authorliabru <liabru@brm.io>2014-08-18 19:39:47 +0100
committerliabru <liabru@brm.io>2014-08-18 19:39:47 +0100
commitee83317ea0a231ba869340dfcc38f9565956c152 (patch)
treed4bf2deac570b92a09528a65c9c5698732784536 /jquery.matchHeight.js
parentb6f612a8b17a64043e758edb97dad887d906f18f (diff)
downloadjquery-match-height-ee83317ea0a231ba869340dfcc38f9565956c152.zip
jquery-match-height-ee83317ea0a231ba869340dfcc38f9565956c152.tar.gz
jquery-match-height-ee83317ea0a231ba869340dfcc38f9565956c152.tar.bz2
added maintainScroll functionality, closes #18
Diffstat (limited to 'jquery.matchHeight.js')
-rw-r--r--jquery.matchHeight.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/jquery.matchHeight.js b/jquery.matchHeight.js
index f0bbeb8..b6db590 100644
--- a/jquery.matchHeight.js
+++ b/jquery.matchHeight.js
@@ -47,6 +47,10 @@
var $elements = $(elements),
rows = [$elements];
+ // take note of scroll position
+ var scrollTop = $(window).scrollTop(),
+ htmlHeight = $('html').outerHeight(true);
+
// get rows if using byRow, otherwise assume one row
if (byRow) {
@@ -122,6 +126,10 @@
});
});
+ // restore scroll position if enabled
+ if ($.fn.matchHeight._maintainScroll)
+ $(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
+
return this;
};
@@ -155,6 +163,7 @@
$.fn.matchHeight._groups = [];
$.fn.matchHeight._throttle = 80;
+ $.fn.matchHeight._maintainScroll = false;
var previousResizeWidth = -1,
updateTimeout = -1;