Igor Simic
7 years ago

How to prevent touchstart when scrolling on mobile

When you have auto-complete list or if you want to swipe over some buttons you can not use touchstart or touchend becuase soon as you tap on button/list of buttons, touchstart/touchend will be executed and no matter what you do next slide/swipe this is not going to be executed because tap on a button have higher priority.

So to fix this problem you can use something like this:
var touchmoved;
        $autocomplete.on('touchend click','li', function(e){
            if(touchmoved != true){
        }).on('touchmove', function(e){
            touchmoved = true;
        }).on('touchstart', function(){
            touchmoved = false;