Permalink
Browse files

Swipe left and right

  • Loading branch information...
1 parent 2da407b commit c2277bb4682a5355043ec3a81085f77f8c079d84 @ryanki1 committed Mar 16, 2013
@@ -196,6 +196,21 @@
resetPuttMat: function () {
$(".ballInTheHole").removeClass("ballInTheHole");
},
+ getPuttMatBallIndex: function () {
+ var ballIndex = -1;
+ $.each($("#puttMat a"), function (index, ele) {
+ debugger;
+ if ($(ele).hasClass("ballInTheHole")) {
+ debugger;
+ ballIndex = index;
+ return false;
+ }
+ });
+ return ballIndex;
+ },
+ getPuttMatHoles: function () {
+ return $("#puttMat a").length;
+ },
teeOff: function (index) {
//debugger;
app.resetPuttMat();
@@ -18,10 +18,17 @@
});
$('body').live('swipeleft swiperight', function (event) {
if (event.type == "swiperight") {
- alert("swipped right side");
+ debugger;
+ var index = app.getPuttMatBallIndex();
+ var range = app.getPuttMatHoles() - 1;
+ index = index == range ? index : index + 1;
+ app.teeOff(index);
}
if (event.type == "swipeleft") {
- alert("swipped left side");
+ debugger;
+ var index = app.getPuttMatBallIndex();
+ index = index == 0 ? 0 : index - 1;
+ app.teeOff(index);
}
event.preventDefault();
});

0 comments on commit c2277bb

Please sign in to comment.