0 points

javascript - prevent touchstart when swiping / scrolling - Stack Overflow


dashboard

Thu Sep 17 2020 08:29:16 GMT+0000 (UTC)

Posted 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_copy Copy

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