zjm1126 zjm1126 - 2 years ago 98
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
Answer Source
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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download