Skip to content

Commit

Permalink
added maintainScroll functionality, closes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Aug 18, 2014
1 parent b6f612a commit ee83317
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
10 changes: 5 additions & 5 deletions jquery.matchHeight-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions jquery.matchHeight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Expand Down Expand Up @@ -122,6 +126,10 @@
});
});

// restore scroll position if enabled
if ($.fn.matchHeight._maintainScroll)
$(window).scrollTop((scrollTop / htmlHeight) * $('html').outerHeight(true));

return this;
};

Expand Down Expand Up @@ -155,6 +163,7 @@

$.fn.matchHeight._groups = [];
$.fn.matchHeight._throttle = 80;
$.fn.matchHeight._maintainScroll = false;

var previousResizeWidth = -1,
updateTimeout = -1;
Expand Down

0 comments on commit ee83317

Please sign in to comment.