$ionicScrollDelegate stop listening


#1

I am trying to build a function that show an div when the user scroll below 80px.

<ion-content on-scroll="getScrollPosition()">
<div class="header" ng-show="show">
</ion-content>
    $scope.getScrollPosition = function(){
console.log("Scroll pos from top: ", $ionicScrollDelegate.getScrollPosition().top)

if ($ionicScrollDelegate.getScrollPosition().top >= 80) {
  $scope.show=true;
  console.log("show header");
}
else  {
  $scope.show=false;
  console.log("hide header");
}

      }

It all works the first couple times when I scroll, but if I scroll below 80px, scroll back to top, and scroll below 80px again, then the div is either constantly showing, or not showing at all.

The console shows the right scroll position, but it is like the if function stops working.

Any ideas on how to solve this problem?
Thanks!