$ionicScrollDelegate stop listening


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">
    $scope.getScrollPosition = function(){
console.log("Scroll pos from top: ", $ionicScrollDelegate.getScrollPosition().top)

if ($ionicScrollDelegate.getScrollPosition().top >= 80) {
  console.log("show header");
else  {
  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?