Skip to content

Instantly share code, notes, and snippets.

@philippgerbig
Created December 7, 2016 08:13
Show Gist options
  • Select an option

  • Save philippgerbig/5a54702efb8483325db2f2a038584602 to your computer and use it in GitHub Desktop.

Select an option

Save philippgerbig/5a54702efb8483325db2f2a038584602 to your computer and use it in GitHub Desktop.
get touch point position
function getMouseTouchPointPosition( e ) {
var result = {
x : 0,
y : 0
};
if (e.originalEvent.touches) {
var touches = e.originalEvent.touches;
if (touches.length > 0) {
result.x = touches[0].pageX;
result.y = touches[0].pageY;
}
} else {
result.x = e.pageX;
result.y = e.pageY;
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment