Skip to content

Instantly share code, notes, and snippets.

@ixisio
Last active December 12, 2015 00:48
Show Gist options
  • Save ixisio/4685856 to your computer and use it in GitHub Desktop.
Save ixisio/4685856 to your computer and use it in GitHub Desktop.
function touchMoveOut(evt) {
var
touchObj = {}
, tolerance = 15
, containment
, px
, py
touchObj.coords = evt.touches[0] || evt.changedTouches[0]
px = touchObj.coords.pageX
py = touchObj.coords.pageY
// @prob -> Life would be much easier with native supported
// tap events.
// evt.touches[0] refers to orginated DOM Element
// NOT to the actual element under the finger, sucks!
// @solution -> (A) document.elementFromPoint(px, py) ?
// (B) store all possible candidates (DOM-Elements)
// and compare their position (w,h + offset x,y)
// with the current touch point.
// (C) @todo -> try to find another one!
}
document.addEventListener("touchmove", touchMoveOut, false)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment