ionicScrollDelegate: how to call function after x amount of pixels have been scrolled?


I’m trying to call a function when an X amount of pixels have been scrolled, from any position. Is this possible? I’ve done something similar with ionicScrollDelegate.getScrollPosition().top, but that just gives me the amount of pixels that have been scrolled from the top, and I want it to be able to call a function after X amount of px scrolled, no matter where the user is in the ion-content. Is this possible??


I’d use a directive to detect scrolling. Give something like this a try:

Basically, I added a directive to ion-content. Then, I watch for scrolling. If it exceeds some preset iimit, it logs to the console. You’ll need to clean it up a bit to suit your needs.

Get scroll direction