我已经Android app使用cordova 2.6.0. 我menu在我的应用程序中使用html标记实现了一项功能,该功能在jQuery与设备的menubutton. 但我无法想出要达到以下要求,表现得像本机应用程序。
要求
如果是,则menu应该隐藏在按下设备上。如果不可见,则现在应该正常运行,也就是说,它应该或转到。backbuttonmenuvisiblemenubackbuttonexitappback history
这是我的代码
document.addEventListener('deviceready', function(){
document.addEventListener('menubutton', function(){
//Toggle Menu
//Which is working fine
});
document.addEventListener('backbutton', function(){
if(menu is visible) {
//Hide the menu
//This is also working fine
return false;
}
//BUT the default action of backbutton has gone. It cannot exit the app , neither it brings to back history.
//return true;
//I have also tried to return boolean true , but facing the same problem.
});
}, false);
实际问题
eventlistener如果我为backbutton设备附加了一个Back Button被禁用的,它不能正常工作。
我的问题是
是否document.addEventListener('backbutton', function(){});过度使用设备的后退按钮?如何摆脱它?
这发生在 Android 4.1.2 设备上