jeudi 26 février 2015

Use swipe gesture to move from one page to another page


I am building an app in phonegap for windows surface pro 3 tablet using AngularJS and Foundations. A user should be able to swipe sideways to move from one page to another. I don't know how to approach this problem and i tried using various libraries like hammer.js, swipe.js but doesn't seem to work. Can anyone help ?


this is the code that i wrote in hammerjs and then called the "swipeleft" function on one of the html element. It works fine, but on each swipe i should go to next page, right now it goes to only one page.



var myElement = document.getElementById('first');
var hammer = new Hammer.Manager(myElement);
var swipe = new Hammer.Swipe();
hammer.add(swipe);
hammer.on('swipeleft', function(){
window.location = '#/food-truck';
});




Aucun commentaire:

Enregistrer un commentaire