diff --git a/src/fsm-sticky-header.js b/src/fsm-sticky-header.js index 4a61e29..b5eb440 100644 --- a/src/fsm-sticky-header.js +++ b/src/fsm-sticky-header.js @@ -3,7 +3,7 @@ (function(angular){ var fsm = angular.module('fsm', []); - fsm.directive('fsmStickyHeader', [function(){ + fsm.directive('fsmStickyHeader', ['$timeout', function($timeout){ return { restrict: 'EA', replace: false, @@ -23,7 +23,7 @@ var unbindScrollBodyWatcher = scope.$watch('scrollBody', function(newValue, oldValue) { content = $(scope.scrollBody); - init(); + $timeout( init, 500); unbindScrollBodyWatcher(); }); @@ -106,7 +106,13 @@ clonedHeader.css({ position: 'fixed', 'z-index': scope.fsmZIndex || 10000, - visibility: 'hidden' + visibility: 'hidden', + /* + Fix problem header displayed in new position after delay + when scrolling. + https://stanko.github.io/ios-safari-scoll-position-fixed/ + */ + transform: 'translate3d(0,0,0)' }); calculateSize(); }; @@ -398,7 +404,7 @@ var scrollPercent = (s / (d-c)); if (scrollPercent > 0.98) { - // We use scope.apply here to tell angular about these changes because + // We use scope.apply here to tell angular about these changes because // they happen outside of angularjs context... we're using jquery here // to figure out when we need to load another page of data. transcludedScope.$apply(nextPage);