I'm trying to execute some code whenever a touchmove
event is fired. However, the touchmove
event is very buggy right now. In many browsers, including the Android browser and Chrome 34.
A "solution" does exist to try to "fix" this problem:
$('html').on('touchmove', function(e) {
e.preventDefault();
//...
});
By adding preventDefault
it will cause the browser to update the event. However it also stopped all further touchmove
events which I didn't really want.
Is there, by any chance, a workaround that fixes this bug but also not cancelling the event? Thanks.
I believe you will need a bit more to it, and I think the answer is somewhere in terms of using all the other events in coordination and managing an "active" state.
el.on('touchstart mousedown', function(e) ...
el.on('touchcancel', function(e) ...
el.on('touchmove mousemove', function(e) ...
el.on('touchend mouseup', function(e) ...
I use angular-touch for a few things and they seem to be tackling the same problems, its worth looking at some example code. https://github.com/angular/bower-angular-touch/blob/master/angular-touch.js#L122
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.