Skip to content

Commit

Permalink
Optimize scrolling
Browse files Browse the repository at this point in the history
Minimized layout requests by putting `scrollTop` calls to a throttled
callback.
  • Loading branch information
skhilko committed Apr 25, 2015
1 parent b4ca77a commit a410e26
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ StickyHeaders.prototype.onHeaderActivate = function(ev) {
};

StickyHeaders.prototype.onScroll = function() {
this._latestKnownScrollTop = this.element.scrollTop;
this._requestUpdate();
};

Expand All @@ -118,7 +117,7 @@ StickyHeaders.prototype._requestUpdate = function() {
};

StickyHeaders.prototype.updateHeaders = function() {
var scrollTop = this._latestKnownScrollTop + this._listStyles.borderTopWidth;
var scrollTop = this.element.scrollTop + this._listStyles.borderTopWidth;
var shiftAmount = 0;

this.headers.forEach(function(header) {
Expand Down

0 comments on commit a410e26

Please sign in to comment.