语言

Menu
Sites
Language
Problem with hammer js gestures

I try to use hammer js for detecting gestures. Today i have found a one problem. When i tap on the menu button in my app, this function is called 3 times! And I see a alert message 3-4 times! and when i go to the next page after menu-page, app automatically go back to the menu page! ( 

So how i can decide this problem? #menubutton is a simple button.

var init = function () {
    
    //create a menubutton function
var menubutton = document.getElementById('menubutton');
    var hammertime = Hammer(menubutton).on("tap", function(event) {
        alert("menu will be open!");
        openMenu();
    }); 
    
    
} ;

$(document).bind('pageinit', init);

 

响应

1 回复
Alex Belousov

I have solved this problem.