Answer the question
In order to leave comments, you need to log in
Why doesn't Angular JS track controller variables when scrolling on mobile?
Sample code from the service
onScroll(){
this.scrollAfterTouchListener('scroll');
}
onTouchStart(){
this.scrollAfterTouchListener('touch');
}
srollAfterTouch(type){
if (type === 'touch') this.touched = true;
if (type === 'scroll' && this.touched){
if ((window.scrollY - this.prevScrollValue) < -50 ){
if (!this.direction || this.direction === "up") this.emit("touchscroll",'down');
this.direction = 'down';
this.prevScrollValue = window.scrollY
}
if ((window.scrollY - this.prevScrollValue) >50 ){
if (!this.direction || this.direction === "down") this.emit("touchscroll",'up');
this.direction = 'up';
this.prevScrollValue = window.scrollY
}
}
}
listenChangeVisiblity() {
services.get(this).scope.$watch(() => this.isVisible, (direction) => {
console.log({"visiblity1":direction});
});
services.get(this).header.on('touchscroll', this.setVisiblityHandler);
}
setVisiblity(direction){
this.isVisible = direction;
console.log({"visiblity2":direction});
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question