在移动设备上滚动页面时阻止touchstart

use*_*021 2 jquery touchstart

我想在用户向下滚动移动设备页面时禁用touchstart事件.该页面具有各种元素,当您单击切换一个类但我希望当用户向下滑动以向下滚动页面时,将触摸touchstart事件.

JQUERY

$(document).on('touchstart click', '.flip-container ', function(event){                       
         event.preventDefault();
        $(this).find('.flipper').toggleClass('hover');
}); 
Run Code Online (Sandbox Code Playgroud)

任何人都知道如何?谢谢!

Lev*_*ker 7

var touchmoved;
$('button').on('touchend', function(e){
    if(touchmoved != true){
        // you're on button click action
    }
}).on('touchmove', function(e){
    touchmoved = true;
}).on('touchstart', function(){
    touchmoved = false;
});
Run Code Online (Sandbox Code Playgroud)

/sf/answers/2248446791/