简体   繁体   English

Android浏览器无法正确响应触摸事件

[英]Android browser not responding properly to touch events

I'm trying to implement swiping gestures for mobile devices in HTML/CSS & Javascript. 我正在尝试在HTML / CSS和Javascript中为移动设备实现滑动手势。

It's very basic, I'm adding event listeners to the the document and trying to log the actions. 这是非常基本的,我正在向文档中添加事件监听器并尝试记录操作。 I'm also trying to prevent the events default behaviour so touch move doesn't drag the window all over the place. 我也试图阻止事件默认行为,因此触摸移动不会拖动整个窗口的窗口。

It works fine in iOS, but not on either of the two android devices I have... 它在iOS中运行良好,但在我拥有的两个Android设备中都没有...

  • Galaxy S II Galaxy S II
  • Galaxy Tab+ 7 Galaxy Tab + 7

Running Android 3.2 运行Android 3.2

I've created a JSFiddle with the a bare bones example here 我在这里用一个简单的例子创建了一个JSFiddle

尝试'ontouchstart' in window而不是'ontouchstart' in window typeof Touch == "object"进行触摸支持检测。

Android doesn't implement " Touch ". Android没有实现“Touch”。 Just change your touchSupport detection. 只需更改touchSupport检测即可。 (

You just have to verify var touchSupport = ('ontouchstart' in window) 你只需要验证var touchSupport = ('ontouchstart' in window)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM