我有一個Ionic應用程序,頭部需要根據scrollTop調整大小。我使用的是離子的滾動事件上IonScroll:Ionic 2 - 當手指離開屏幕時不會觸發滾動事件
import { Scroll } from 'ionic-angular';
@ViewChild(Scroll) scroll: Scroll;
...
ionViewDidLoad() {
this.scroll.addScrollEventListener((ev) => {
console.log('scroll');
});
}
在iOS上,當我把我的手指在屏幕上的滾動事件是完全解僱,但是當手指離開屏幕(但滾動延續,因爲慣性),事件僅在滾動停止時被觸發。
當手指離開屏幕時,是否有辦法收聽滾動事件(或任何其他類似事件)?
我發現這個問題,這似乎是相似的,但沒有任何回答:iOS scroll event not firing as often when finger is off of the screen
你可以試試'touchmove'' touchstart'' touchend'事件 – Duannx
我想要的是當手指沒有觸摸屏幕時(即當內容由於iOS上的滾動動態而仍然滾動時)聽滾動,我相信'touchstart '','touchend'和'touchmove'僅在手指在屏幕上時被觸發... –