Created
October 20, 2010 08:33
-
-
Save thingsinjars/636030 to your computer and use it in GitHub Desktop.
Quick summary of some Touch Events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.ontouchstart = function(e) { | |
//This will alert coordinates where you touch the screen | |
alert(e.touches[0].pageX+', '+e.touches[0].pageY); | |
//This will alert coordinates if you touch with a second finger at the same time | |
if(e.touches[1]) { | |
alert(e.touches[1].pageX+', '+e.touches[1].pageY); | |
} | |
} | |
document.ontouchmove = function(e) { | |
alert(e.touches[0].pageX+', '+e.touches[0].pageY); | |
} | |
document.ontouchend = function(e) { | |
//This one doesn't have coordinates | |
alert('Finger lifted'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment