Fixes to touch support in Javascript

I have been using the code from the below URL to provide swipe events from javascript:

http://padilicious.com/code/touchevents/

For some reason, it has stopped working for iOS. I had to painfully fix the code which determines the swipe direction:


function determineSwipeDirection() {
    if ((swipeAngle <= 46) && (swipeAngle >= 0)) {
        swipeDirection = 'left';
        //alert(swipeAngle + "-left");
    } else if ((swipeAngle <= 360) && (swipeAngle >= 352)) {
        swipeDirection = 'left';
        //alert(swipeAngle + "-left");
    } else if ((swipeAngle >= 158) && (swipeAngle <= 213)) {
        swipeDirection = 'right';
        //alert(swipeAngle + "-right");
    } else if ((swipeAngle >= 45) && (swipeAngle <= 135)) {
        swipeDirection = 'down';
        //alert(swipeAngle + "-down");
    } else {
        swipeDirection = 'up';
        //alert(swipeAngle + "-up");
    }
}

Comments

Popular posts from this blog

Tutorial: Using Google Cloud Storage from C# and .NET

Late 2008 Macbook only giving 1.5 gb/s speed with 6 gb/s Intel SSD?

The ridiculous interview experience