开发者

ontouch function not being fired on iPhone simulator

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜