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:
- ontouchstart
- ontouchmove
- 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/
精彩评论