javascript - prevent touchstart when swiping / scrolling - Stack Overflow

PHOTO EMBED

Thu Sep 17 2020 08:29:16 GMT+0000 (Coordinated Universal Time)

Saved by @jimmy.samaan #javascript

var touchmoved;
$('button').on('touchend', function(e){
    if(touchmoved != true){
        // button click action
    }
}).on('touchmove', function(e){
    touchmoved = true;
}).on('touchstart', function(){
    touchmoved = false;
});
content_copyCOPY

https://stackoverflow.com/questions/7069458/prevent-touchstart-when-swiping