{"action":"created","issue":{"url":"https://api.github.com/repos/benmajor/jQuery-Touch-Events/issues/87","labels_url":"https://api.github.com/repos/benmajor/jQuery-Touch-Events/issues/87/labels{/name}","comments_url":"https://api.github.com/repos/benmajor/jQuery-Touch-Events/issues/87/comments","events_url":"https://api.github.com/repos/benmajor/jQuery-Touch-Events/issues/87/events","html_url":"https://github.com/benmajor/jQuery-Touch-Events/issues/87","id":116752744,"number":87,"title":"Why position() is used instead of offset()?","user":{"login":"cervengoc","id":6099330,"avatar_url":"https://avatars.githubusercontent.com/u/6099330?v=3","gravatar_id":"","url":"https://api.github.com/users/cervengoc","html_url":"https://github.com/cervengoc","followers_url":"https://api.github.com/users/cervengoc/followers","following_url":"https://api.github.com/users/cervengoc/following{/other_user}","gists_url":"https://api.github.com/users/cervengoc/gists{/gist_id}","starred_url":"https://api.github.com/users/cervengoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cervengoc/subscriptions","organizations_url":"https://api.github.com/users/cervengoc/orgs","repos_url":"https://api.github.com/users/cervengoc/repos","events_url":"https://api.github.com/users/cervengoc/events{/privacy}","received_events_url":"https://api.github.com/users/cervengoc/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-13T11:42:19Z","updated_at":"2015-11-13T11:46:43Z","closed_at":"2015-11-13T11:46:43Z","body":"I've just began to experiment with this project, and seems to be very promising. I just needed a lightweight gesture implementation for jQuery (HammerJS is quite robust for me currently).\r\n\r\nAs I've read through the code I noticed that when calculating the `offset` property of the event data at several places, you use jQuery `position`. If I understand correctly the purpose of the `offset` property is to give the coordinates relative to the target element's topleft corner. If so, shouldn't it be rahter jQuery `offset` of the element?"},"comment":{"url":"https://api.github.com/repos/benmajor/jQuery-Touch-Events/issues/comments/156407578","html_url":"https://github.com/benmajor/jQuery-Touch-Events/issues/87#issuecomment-156407578","issue_url":"https://api.github.com/repos/benmajor/jQuery-Touch-Events/issues/87","id":156407578,"user":{"login":"benmajor","id":1329832,"avatar_url":"https://avatars.githubusercontent.com/u/1329832?v=3","gravatar_id":"","url":"https://api.github.com/users/benmajor","html_url":"https://github.com/benmajor","followers_url":"https://api.github.com/users/benmajor/followers","following_url":"https://api.github.com/users/benmajor/following{/other_user}","gists_url":"https://api.github.com/users/benmajor/gists{/gist_id}","starred_url":"https://api.github.com/users/benmajor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benmajor/subscriptions","organizations_url":"https://api.github.com/users/benmajor/orgs","repos_url":"https://api.github.com/users/benmajor/repos","events_url":"https://api.github.com/users/benmajor/events{/privacy}","received_events_url":"https://api.github.com/users/benmajor/received_events","type":"User","site_admin":false},"created_at":"2015-11-13T11:46:43Z","updated_at":"2015-11-13T11:46:43Z","body":"No, using jQuery's `offset` property on events is not sufficiently robust enough for us to work with this library. Event delegation and bubbling sometimes mean that the values returned by `offset` are not correct, or are relative to a higher parent than we need, particularly when using fixed or absolute positioning. \r\n\r\nAlso, `offset` returns to the current target of the event, **not the bound target** which is the expected return value of the `offset` property in the touch event parameters.\r\n\r\nYou can see how it was improved in the following push:\r\n\r\nhttps://github.com/benmajor/jQuery-Touch-Events/commit/6fe893d76e2d198da11ec6fb41e85cea3fcfc44f?diff=split\r\n\r\nThis is not a valid bug, so am going to close."}}