zjm1126 zjm1126 - 8 months ago 35
Javascript Question

How to get the originalEvent without jQuery on iPhone

For some reason, I can't use jQuery.

This is my code :

document.addEventListener("touchstart", function(e) {

var orig = e.originalEvent;

var x = orig.changedTouches[0].pageX;
var y = orig.changedTouches[0].pageY;

//id("#draggable").css({top: y, left: x});
id("draggable").style.left = x;
id("draggable").style.top = y;


Using jQuery, you can get the
, but if you don't use it, how to get it?


Mic Mic
var x = e.pageX;

If you have Safari on your desktop, open it in iPhone mode
Develop-> User Agent-> Mobile Safari...
And put a breakpoint inside your function, the you can inspect the e object and all its properties.