Skip to content

Commit ee83317

Browse files
committed
added maintainScroll functionality, closes #18
1 parent b6f612a commit ee83317

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

jquery.matchHeight-min.js

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jquery.matchHeight.js

+9
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@
4747
var $elements = $(elements),
4848
rows = [$elements];
4949

50+
// take note of scroll position
51+
var scrollTop = $(window).scrollTop(),
52+
htmlHeight = $('html').outerHeight(true);
53+
5054
// get rows if using byRow, otherwise assume one row
5155
if (byRow) {
5256

@@ -122,6 +126,10 @@
122126
});
123127
});
124128

129+
// restore scroll position if enabled
130+
if ($.fn.matchHeight._maintainScroll)
131+
$(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));
132+
125133
return this;
126134
};
127135

@@ -155,6 +163,7 @@
155163

156164
$.fn.matchHeight._groups = [];
157165
$.fn.matchHeight._throttle = 80;
166+
$.fn.matchHeight._maintainScroll = false;
158167

159168
var previousResizeWidth = -1,
160169
updateTimeout = -1;

0 commit comments

Comments
 (0)