Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

canceling touchend event when touchmove starts

I have a scrollable list in my web app, using scrollability to deal with the overflow:scroll feature. although when I finish scrolling and take my finger out of the screen the event bellow also triggers.

$('li').live('touchend', function (e) {
    //...
});

The thing is that I only would like this event above to fire when the action there's no touchmove event before that.

it is possible to suppress a touchend event from inside the touchmove event? so it simulates better the iOS UITableView component? where when touchmove starts it cancels the target for touchend

like image 747
zanona Avatar asked Feb 21 '23 04:02

zanona


1 Answers

Set a flag in touchmove which can be tested in touchend and if the flag is set, just skip the functionality and possibly preventDefault() (either way, reset the flag at the end).

like image 78
Yaniro Avatar answered Mar 03 '23 16:03

Yaniro