I’m having trouble with the scroll delegate, (snippet below). When the user clicks the button to start scrolling, it works just fine, but the behavior is erradic when stopping and starting the scroll (here, by turning ‘scrolling’ from false to true then back). When the user stops scrolling (scrolling = false) the ion-scroll scrolls jumps back to the top–unless I uncomment the line in the else block to scroll by 0 px Y. Regardless of where the scrolling stops, when I re-initiate the scrolling, the ion-view jumps back to the top and restarts scrollings from the top.
I tried using the scrollDelegate to remember the position of each step, then whenever the user stops scrolling, it’d scroll to that last remembered step (a hackish attempt at a fix) but I’ve had no luck yet…
I’m realizing that I should probably just do this with jQuery (swallow my pride), but I’m really curious why my method isn’t working. Any advice?
this.startScroll = function () {
scrolling = true
step = 3
fr = 200
doScroll = function (){
if(scrolling == true){
scrollDelegate.scrollBy(0,step,true)
scrollDelegate.rememberScrollPosition('pause')
$timeout(doScroll, fr)
} else {
// scrollDelegate.scrollBy(0,0,false)
scrollDelegate.scrollToRememberedPosition('pause')
}
}
doScroll()
};
this.stopScroll = function(){
scrollDelegate.rememberScrollPosition('pause')
scrolling = false
}