I have to simulate longpress using javascript.
var timer;
$(element).on('touchend',function(e){
clearTimeout(timer);
});
$(element).on('touchstart',function(e){
timer=setTimeout(function()
{
//some action
},1000);
return true;
});
When the action is triggered which is displaying a context menu, after that if finger is lifted then at touchend event the context menu hides . I want to avoid this.I want cancel all touch events until next touchstart What should i do. The problem is only in ios.
Hmm, did you try clear queue ??
maybe use .stop()
to clear or .clearQueue()
ref: https://api.jquery.com/clearQueue/