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");
}
}
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
Post a Comment