Mickey Shine Mickey Shine -5 years ago 132
HTML Question

tell pure touch event and pure gesture event apart?

I am doing iphone web development and I've noticed that: gesture events can also be touch events, which means a touch event handler also fires up when there is a gesture event.

Any way that I can add specific event handler to gesture (not touch)? Or how can I know if this is a pure touch event or a pure gesture event?

Answer Source

Edit: This was an answer for your original revision that asked if something is a "pure touch event". It won't help you with your changed question on getting pure gesture events.

Listen for gesture events and have a gesturing boolean that you check during touch events that is set to true by the event handler for the gesture events and set back to false by the event handler for the touch events if it is true.

I have not researched at all about these events, but here's a sample implementation:

var gesturing = false;
document.addEventListener(aTouchEventName, function () {
    if (gesturing) {
        return gesturing = false;
    // your touch event handler code here
}, false);

document.addEventListener(aGestureEventName, function () {
    gesturing = true;
}, false);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download