javascript equivalent of 'mouseleave' for touch interactions
It's been suggested, but not implemented AFAIK: http://www.quirksmode.org/mobile/advisoryTouch.html
Something like this might work (writing it from top of my head, untested):
var element;
document.addEventListener('touchstart', function(event) {
event.preventDefault();
var touch = event.touches[0];
element = document.elementFromPoint(touch.pageX,touch.pageY);
}, false);
document.addEventListener('touchmove', function(event) {
event.preventDefault();
var touch = event.touches[0];
if (element !== document.elementFromPoint(touch.pageX,touch.pageY)) {
touchleave();
}
}, false);
function touchleave() {
console.log ("You're not touching the element anymore");
}