Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix djett41#14
Stop showing header during infinite scroll.
  • Loading branch information
amrael committed Oct 30, 2015
1 parent cc03924 commit 364fcb3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 43 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
node_modules
bower_components
bower_components
/.vs/
/*.jsproj
/*.jsproj.user
/*.sln
/taco.json
27 changes: 6 additions & 21 deletions dist/ionic.scroll.sista.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,11 @@
/**
* Before the active view leaves, reset elements, and reset the scroll container
*/
$scope.$parent.$on('$ionicView.beforeLeave', function () {
isNavBarTransitioning = true;
translateElementsSync(0);
activeHeader = null;
cachedHeader = null;
});

/**
* Scroll to the top when entering to reset then scrollView scrollTop. (prevents jumping)
*/
$scope.$parent.$on('$ionicView.beforeEnter', function () {
if (scrollView) {
scrollView.scrollTo(0, 0);
}
$scope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
isNavBarTransitioning = true;
translateElementsSync(0, 0);
activeHeader = null;
cachedHeader = null;
});

/**
Expand All @@ -271,20 +262,14 @@
if (isNavBarTransitioning) {
return;
}
//support for jQuery event as well
//support for jQuery events
e = e.originalEvent || e;

var duration = 0;
var scrollTop = e.detail.scrollTop;

y = scrollTop >= 0 ? Math.min(defaultEnd, Math.max(0, y + scrollTop - prevScrollTop)) : 0;

//if we are at the bottom, animate the header/tabs back in
if (scrollView.getScrollMax().top - scrollTop <= contentTop) {
y = 0;
duration = defaultDuration;
}

prevScrollTop = scrollTop;

//if previous and current y are the same, no need to continue
Expand Down
2 changes: 1 addition & 1 deletion dist/ionic.scroll.sista.min.js

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

25 changes: 5 additions & 20 deletions js/ionic.scroll.sista.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,20 +235,11 @@
/**
* Before the active view leaves, reset elements, and reset the scroll container
*/
$scope.$parent.$on('$ionicView.beforeLeave', function () {
isNavBarTransitioning = true;
translateElementsSync(0);
activeHeader = null;
cachedHeader = null;
});

/**
* Scroll to the top when entering to reset then scrollView scrollTop. (prevents jumping)
*/
$scope.$parent.$on('$ionicView.beforeEnter', function () {
if (scrollView) {
scrollView.scrollTo(0, 0);
}
$scope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
isNavBarTransitioning = true;
translateElementsSync(0, 0);
activeHeader = null;
cachedHeader = null;
});

/**
Expand Down Expand Up @@ -279,12 +270,6 @@

y = scrollTop >= 0 ? Math.min(defaultEnd, Math.max(0, y + scrollTop - prevScrollTop)) : 0;

//if we are at the bottom, animate the header/tabs back in
if (scrollView.getScrollMax().top - scrollTop <= contentTop) {
y = 0;
duration = defaultDuration;
}

prevScrollTop = scrollTop;

//if previous and current y are the same, no need to continue
Expand Down

0 comments on commit 364fcb3

Please sign in to comment.