开发者

Javascript page repaint halted during touchmove event

开发者 https://www.devze.com 2023-04-10 07:33 出处:网络
I have an element that is moved (via altering it\'s leftmargin) relative to a user touch on a mobile device (i.e. dragging it around the screen with your finger).

I have an element that is moved (via altering it's leftmargin) relative to a user touch on a mobile device (i.e. dragging it around the screen with your finger).

I have noticed that during a touchmove event (which i believe fires repeatedly for the entire time between touchstart and touchend), the browser does not repaint the window, meaning that the display is not updated until after the user takes their finger off the screen.

I haven't had the opportunity to test this across various devices, so it could only relate to Android devic开发者_如何学编程es, or to webkit, or a wider group.

Has anybody come accross this and might there be a workaround to force the browser to redraw during the events duration?


Call event.preventDefault() on the touchstart event.

http://uihacker.blogspot.tw/2011/01/android-touchmove-event-bug.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号