手机端上下触摸滑动监听

$('body').on('touchstart',function(e){
    startY = e.originalEvent.changedTouches[0].pageY;
});
$('body').on('touchend',function(e){
    moveEndY = e.originalEvent.changedTouches[0].pageY,
    Y = moveEndY - startY;
    if (Y < 0 ){
        console.log('向下浏览');
    } else if (Y > 0) {
        console.log('向上浏览');
    }
})

 

posted @ 2022-01-06 10:11  Arya-Wang  阅读(133)  评论(0)    收藏  举报