Touch move getting stuck Ignored attempt to cancel a touchmove

后端 未结 5 1291
耶瑟儿~
耶瑟儿~ 2020-12-02 19:47

I\'m messing around with touch events on a touch slider and I keep getting the following error:

Ignored attempt to cancel a touchmove event with canc

5条回答
  •  情歌与酒
    2020-12-02 20:28

    The event must be cancelable. Adding an if statement solves this issue.

    if (e.cancelable) {
       e.preventDefault();
    }
    

    In your code you should put it here:

    if (this.isSwipe(swipeThreshold) && e.cancelable) {
       e.preventDefault();
       e.stopPropagation();
       swiping = true;
    }
    

提交回复
热议问题