简体   繁体   English

iOS4无法检测到左右滑动

[英]iOS4 cannot detect left right swipe

I am producing a mobile website (safari mobile not uiwebview), with jQuery and the viewport meta tag. 我正在制作一个带有jQuery和视口meta标签的移动网站(Safari浏览器而不是uiwebview)。

<meta name="viewport" content="width=500, user-scalable=0, initial-scale=default" id="viewport">

I have swipe detection working via the jQuery touchSwipe plugin http://labs.skinkers.com/touchSwipe/ 我通过jQuery touchSwipe插件http://labs.skinkers.com/touchSwipe/进行了滑动检测

$(window).swipe({
    swipeLeft  :function(){ console.log('1'); arrows.eq(1).click(); },
    swipeRight :function(){ console.log('0'); arrows.eq(0).click(); },
    allowPageScroll:"vertical"
});

Swipe detects fine on iPad iOS5 and Android but iPhone iOS4 nothing triggers. 滑动可在iPad iOS5和Android上正常检测,但iPhone iOS4不会触发任何事件。 I did some debugging 我做了一些调试

document.ontouchstart = function(e){
     console.log(e.touches[0].clientX+' | '+e.touches[0].clientY);
};

tried out all the basics clientX pageX ect. 试用了clientX pageX ect的所有基础知识。 all seems to work fine and return valid data. 一切似乎都能正常工作并返回有效数据。 Anyone have any ideas? 有人有想法么?

Solved it. 解决了。 This issue was very simple: 这个问题很简单:

$(window)

does not receive touch events in iOS4 while it does in iOS5 and Android. 在iOS5和Android中不会在iOS4中接收触摸事件。 While

$(document)

DOES receive touch events on all devices. 不会在所有设备上接收触摸事件。 Go figure. 去搞清楚。

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

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