Swipe event triggering twice

Swipe event triggering twice

BY 08 Mar 2020 Web Application Development

Hi,

I am building a web app that uses the tau page system, each page has a swipe gesture event attached to it but they get triggered twice.

I can’t actually find any examples of using the page system with swiping, is it not the right way??

here’s my code:

function mainSwipeEvent(e){
    console.log("Main Page Swiped");
    if (e.detail.direction == "left") {
        tau.changePage('#info');
    }
    if (e.detail.direction == "right") {
        tau.changePage('#settings');
    }
}
tau.event.enableGesture(mainPage, new tau.event.gesture.Swipe({
        orientation: "horizontal"
	}));
mainPage.addEventListener("swipe", function (e) {mainSwipeEvent(e);});

This is driving me crazy, so any help would be appreciated.

Duncan

Written by