jeudi 14 juillet 2016

Open sidebar when when user swipes from edges with Hammer.js


In my website I'm using hammer.js to open sidebar menu on swipe left. I've written this code and it's working:

Hammer(document.getElementById("page-content-wrapper")).on("swiperight", function() {
  wrapper.addClass("toggled");
});

But I want to open the sidebar when user swipe left from the left edge of the screen. I've tried these answers - Javascript touch movement, track when user swipes from edges but it didn't work. Any idea how can I implement this? Thanks.


Aucun commentaire:

Enregistrer un commentaire