$ionicScrollDelegate.getScrollPosition().top always return 0 after deploy to device
I am using v1.0.0-beta.10, I want to detect the scroll position using $ionicScrollDelegate.getScrollPosition().top method.
It returns the correct value when using a chrome browser, but once I deploy to my device, $ionicScrollDelegate.getScrollPosition().top always returns 0.
my code:
<ion-view hide-back-button="true">
<ion-content has-bouncing="true" class="has-header has-subheader" id="store-container" on-scroll="onScoll()">
</ion-content>
.controller('HomeStoresCtrl', function($state, $ionicScrollDelegate, ...
$scope.onScoll = function() {
console.log($ionicScrollDelegate.getScrollPosition().top)
}
I am having the same issue. How do you resolve it ?
I experience the same issue, also in the browser using ionic serve.
Aulie
http://nmr.co.ke/tik
16.03.2015, 19:48, "Aulie" [email protected]:I experience the same issue, also in the browser using ionic serve.
—Reply to this email directly or .
Same problem here. No solution so far?
I experienced the same issue as well, so my workaround was doing this:
document.getElementById(YOUR ELEMENT).getBoundingClientRect().top;
And this let me determine the position of whatever element I wanted. Not exactly the same use case as getScrollPosition, but once I got this working, I was able to re-think how I could do scrolling.
Hope this helps!
+1 @danbucholtz Can you please open this issue. Facing the same in Ionic 1.2.4
+1 Same one here.... "version": "1.3.1",
My workaround by now is this function.
function getElementOffset(element){
var de = document.documentElement;
var box = element.getBoundingClientRect();
var top = box.top + window.pageYOffset - de.clientTop;
var left = box.left + window.pageXOffset - de.clientLeft;
return { top: top, left: left };
}