Skip to content

Commit

Permalink
swipe to change block date
Browse files Browse the repository at this point in the history
  • Loading branch information
ezwang committed Mar 21, 2016
1 parent d859a28 commit c780dc5
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion intranet/static/js/eighth/signupUI.js
Expand Up @@ -179,4 +179,38 @@ $(function() {
$("#activity-list").on("scroll", function() {
sh.scroll();
});
});

var initX = null, initY = null, listening = false;
$(".day-picker").on("touchstart", function(e) {
e.stopPropagation();
initX = e.originalEvent.touches[0].clientX;
initY = e.originalEvent.touches[0].clientY;
listening = true;
});
$(".day-picker").on("touchend", function(e) {
e.stopPropagation();
listening = false;
});
$(".day-picker").on("touchmove", function(e) {
e.stopPropagation();
if (!listening) {
return;
}
var nowX = e.originalEvent.touches[0].clientX;
var nowY = e.originalEvent.touches[0].clientY;
if (Math.abs(nowY - initY) > 30) {
listening = false;
return;
}
var diffX = nowX - initX;
if (Math.abs(diffX) > 30) {
if (diffX > 0) {
$(".earlier-days").click();
}
else {
$(".later-days").click();
}
listening = false;
}
});
});

0 comments on commit c780dc5

Please sign in to comment.