davids
davids

Reputation: 6371

iOS 4 issues with event.layerX and event.layerY on touchstart

This code:

$(doc).on('touchstart touchend', function(ev){
    var or = ev.originalEvent;
    console.log('y: '+or.layerY+' x '+or.layerX);
});

Is displaying the coordinates of the position where I tap on in iOS 5, but in iOS 4 is giving 0 for both coordinates. doc is a variable that contains the contentDocument of an iframe and I'm using jQuery 1.7.1. Any thought?

Upvotes: 0

Views: 533

Answers (1)

davids
davids

Reputation: 6371

I ended up using the properties ev.originalEvent.touches[0].pageX and ev.originalEvent.touches[0].pageY. Don't know why layerX and layerY are not working properly, but the other ones seems to make the trick

Upvotes: 1

Related Questions