summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2016-10-01 08:58:41 -0400
committerPliable Pixels <pliablepixels@gmail.com>2016-10-01 08:58:41 -0400
commitd7ccd6957bd967daf7ad218d7f66419f01ababf2 (patch)
tree617672f9d17a94e87927679dd123b9571b4fd95d
parent231c8f14a84b5493eed9b221c095a72e996e0366 (diff)
fixed sista code for 20px adjustment
Former-commit-id: 54bdee98336fb35efb80f438c2e8ed68cd5f586e
-rw-r--r--www/external/ionic.scroll.sista.js16
1 files changed, 15 insertions, 1 deletions
diff --git a/www/external/ionic.scroll.sista.js b/www/external/ionic.scroll.sista.js
index 63711ff9..a6b173c6 100644
--- a/www/external/ionic.scroll.sista.js
+++ b/www/external/ionic.scroll.sista.js
@@ -3,7 +3,7 @@
'use strict';
angular.module('jett.ionic.scroll.sista', ['ionic'])
- .directive('scrollSista', ['$document', '$timeout', '$rootScope', '$ionicScrollDelegate', function($document, $timeout, $rootScope, $ionicScrollDelegate) {
+ .directive('scrollSista', ['$document', '$timeout', '$rootScope', '$ionicScrollDelegate', '$ionicPlatform',function($document, $timeout, $rootScope, $ionicScrollDelegate, $ionicPlatform) {
var TRANSITION_DELAY = 400;
var defaultDelay = TRANSITION_DELAY * 2;
var defaultDuration = TRANSITION_DELAY + 'ms';
@@ -30,6 +30,7 @@
var body = $document[0].body;
var scrollDelegate = $attr.delegateHandle ? $ionicScrollDelegate.$getByHandle($attr.delegateHandle) : $ionicScrollDelegate;
var scrollView = scrollDelegate.getScrollView();
+ var isIos = false;
//coordinates
var y, prevY, prevScrollTop;
@@ -85,7 +86,15 @@
return;
}
+ // credit - adapted 20px PR from https://github.com/driftyco/ionic-ion-header-shrink/pull/10
+
headerHeight = activeHeader.offsetHeight;
+ $ionicPlatform.ready(function() {
+ if($ionicPlatform.is('ios')) {
+ isIos = true;
+ headerHeight -= 20; // account 20px for the ios status bar
+ }
+ });
contentTop = headerHeight;
//since some people can have nested tabs, get the last tabs
@@ -278,6 +287,11 @@
var scrollTop = e.detail?e.detail.scrollTop:e.target.scrollTop;
y = scrollTop >= 0 ? Math.min(defaultEnd, Math.max(0, y + scrollTop - prevScrollTop)) : 0;
+ if (isIos && y >headerHeight)
+ {
+ y = headerHeight;
+ }
+
//if we are at the bottom, animate the header/tabs back in
if (scrollView.getScrollMax().top - scrollTop <= contentTop) {