首页 > 其他 > 详细

touchmove Bug 工作遇到

时间:2016-01-27 14:21:53      阅读:195      评论:0      收藏:0      [点我收藏+]

touchmove在安卓浏览器上只会触发一次,需要preventDefault()

 

touchmove events in Android web browsers have a really serious bug. If you don‘t include the following code, the touchmove event will fire once, but not again until you‘re done moving your touch, which utterly kills the usefulness of the touchmove event. It‘s a weird one, and may very well break more advanced touch logic that works on iOS. But if you preventDefault() on the touchstart event, your touchmove will function as expected.

  
 
  1. element.addEventListener( "touchstart", function(e){ onStart(e); }, false );
  2. function onStart ( touchEvent ) {
  3.   if( navigator.userAgent.match(/Android/i) ) {
  4.     touchEvent.preventDefault();
  5.   }
  6. }

touchmove Bug 工作遇到

原文:http://www.cnblogs.com/chuangweili/p/5162971.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!