I'm trying to execute some function while scrolling. Basically if a certain scroll position is met I want the app to do something.
Here some of the code:
ionViewDidLoad() {
this.content.ionScroll.subscribe((event) => {
this.scrollPosition = event.scrollTop;
if(this.scrollPosition >= 100){
console.log("more than 100");
}
else {
console.log("less than 100");
}
});
}
It works as expected on web browsers or Android devices, it repeatedly runs the "console.log()"s within the condition while scrolling. On iOS, instead, it waits for the scroll to stop and then it does the console.log(). I was reading that on iOS javascript gets stopped while scrolling, for performance reasons. Is there a workaround for this?