Skip to content

Commit

Permalink
added crutch to make swipes work
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolerd committed Aug 22, 2015
1 parent 18319b7 commit 5c7845d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions project/static/src/js/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,19 @@
gal.addEventListener("mouseleave", function(e) {
gallery.removeClass("play");
});

// Touches (a primitive crutch)
var touchX;
gal.addEventListener("touchstart", function(e) {
touchX = e.changedTouches[0].clientX;
});
gal.addEventListener("touchmove", function(e) {
var diff = touchX - e.changedTouches[0].clientX;
touchX = e.changedTouches[0].clientX;
gal.scrollLeft += diff;
});
gal.addEventListener("touchend", function(e) {
touchX = undefined;
});
}));
})(require("npm-zepto"));

0 comments on commit 5c7845d

Please sign in to comment.