Is there a way to get a scrolling position directly from Cordova?


I have a problem with ionic framework's native scroll. The following works fine in the browser, but not when compiled to iOS. If I poll the $ionicScrollDelegate.getScrollPosition() at an interval, I don't get up-to-date values for positions. It's only if the deceleration ends or the user touches again that the value is updated. I spelunked through all the ionic scroll code, but it seems that the __scrollLeft value comes from an even deeper internal API since I'm trying to use native, not js scrolling.

In an attempt to hack around it, I tried using the DOM API to get the window-relative position of my content:

inversePosition = divContainer.getBoundingClientRect().left;

but this suffered from the same lack of updates. This makes me think it may not even be possible.

Is there a way to get the position more directly? I'm willing to dive into the ionic js bundle myself, but I don't know where to start in terms of even finding the core cordova scrolling API documentation.

Basically, my use-case is similar to that of a mapping app, I need realtime accurate scroll position data.

I opened an issue in the ionic lib, but I doubt anyone will get to it with 398 other open issues....

tagging phonegap because because phonegap wraps cordova as well, and solutions in phonegap may be applicable to this problem.

Check iScroll

I haven't used it in ionic projects, only in backbone-cordova projects, but I suppose that it will work the same.

It adds a lot of functionalities on the scroll at javascript level, Its a little difficult to implement, as it uses their own model of CSS and HTML, but it offers you a lot of things in exchange, for example, current position.