Determine touch position on tablets with JavaScript
问题 I have an object with the name "element". If somebody touches the tablet, I would like to return the x and y coordinates of the touch position relative to the object, i. e. the upper left corner of the object has the coordinates x=0 and y=0. I know how to implement this on desktops: $(function() { $(document).mousedown(function(e) { var offset = $("#element").offset(); var relativeX = (e.pageX - offset.left); var relativeY = (e.pageY - offset.top); alert(relativeX+':'+relativeY); $(".position