开发者

ontouch function not being fired on iPhone simulator

开发者 https://www.devze.com 2023-03-11 19:42 出处:网络
On the iPhone Simulator, the event callback for ontouch doesn\'t seem to be working. The following does not seem to work on my simulator开发者_如何学Go:

On the iPhone Simulator, the event callback for ontouch doesn't seem to be working.

The following does not seem to work on my simulator开发者_如何学Go:

document.ontouch = function() {
    alert('it works!');
}

Although this does return true:

if ('ontouch' in document) {
    alert('touch supported');
}

Has anyone else had this issue?


There are 3 touch related events:

  1. ontouchstart
  2. ontouchmove
  3. ontouchend

Try it with these and it should be OK!

Some good examples can be found with this article:

http://www.sitepen.com/blog/2008/07/10/touching-and-gesturing-on-the-iphone/

0

精彩评论

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

关注公众号