Get scroll direction

Is it possible to get the scroll direction in ion-content? I need to use different behaviours depending if the user is scrolling to top or to bottom.

thanks

See my sample in this post :

Just create a directive that detects the difference in the elements scrollTop

Thanks,

already solved in a similar way:


myapp.directive('scrolling', function($document) {
  return {
    restrict: 'A',
    link: function(scope, element, attrs) {
      var start = scope.$eval(attrs.scrolling) || 0;

      element.bind('scroll', function(e) {
        if(e.detail.scrollTop >= start) {
          start = e.detail.scrollTop;
          console.log('scroll to bottom');
        } else {
          console.log('scroll to top');
        }
      });
    }
  }
});

I just moved the line : start = e.detail.scrollTop;

right after the else statement.

Otherwise, the directive doesn’t work anymore as soon as you reach the bottom of the scroll range.

I tried the code suggested on this page, but when I reach the bottom the bug is still there. Did you ever manage to figure this out?

Great, but e.detail does not exist in android platform

Struggling with the same thing now, did you manage to find a workaround?

if you are referring to Android issue, this code snippet will fix it

app.config(function($ionicConfigProvider) { if(ionic.Platform.isAndroid()){ $ionicConfigProvider.scrolling.jsScrolling(true); } });

Yes, that is what I was referring to. Thanks! So basically I need to revert to pre-1.2 JS scrolling for this to work.