Skip to content

Commit

Permalink
Add support for older webkit
Browse files Browse the repository at this point in the history
Unable to verify, but hopefully this fixes Safari 7.1+
  • Loading branch information
skhilko committed Apr 9, 2015
1 parent d529996 commit 0858558
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ var SCROLL_WIDTH = (function() {
return scrollbarWidth;
})();

var STYLE_TRANSFORM = (function getTransitionEndEventName() {
var transforms = ['transform', 'webkitTransform'];
for (var i = 0; i < transforms.length; i++) {
if( document.body.style[transforms[i]] !== undefined ){
return transforms[i];
}
}
})();

var SCROLL_STEP_DEFAULT = 50;
var LINE_HEIGHT = 16;

Expand Down Expand Up @@ -136,7 +145,7 @@ StickyHeaders.prototype.updateHeaders = function() {
shiftAmount += this.headerContainerHeight - this.stuckHeadersHeight;

requestAnimationFrame(function(containerOffset) {
this.headerContainer.style.transform = 'translateY(' + containerOffset + 'px)';
this.headerContainer.style[STYLE_TRANSFORM] = 'translateY(' + containerOffset + 'px)';
this._updating = false;
}.bind(this, shiftAmount));
};
Expand Down

0 comments on commit 0858558

Please sign in to comment.