phonegap 双击退出按钮退出应用程序代码
phonegap 双击退出按钮退出应用程序代码分享给大家
如有疑问加qq群讨论:103759305
关于jqm的提示信息<script type="text/javascript">
//提示信息
function showMyAlert(text) {
$.mobile.loadingMessageTextVisible = true;
$.mobile.showPageLoadingMsg("a", text, true);
}
function myAlert(text) {
showMyAlert(text);
setTimeout(hideLoading, 2000);
}
function hideLoading() {
$.mobile.hidePageLoadingMsg();
}
</script>增加返回按钮事件document.addEventListener("backbutton", eventBackButton, false);//返回按钮被按了function eventBackButton() {
if ($.mobile.activePage.is('#indexPage')) {
myAlert('再点击一次退出!');
document.removeEventListener("backbutton", eventBackButton, false); // 注销返回键
document.addEventListener("backbutton", exitApp, false);// 绑定退出事件
// 3秒后重新注册
var intervalID = window.setTimeout(function() {
window.clearTimeout(intervalID);
document.removeEventListener("backbutton", exitApp, false); // 注销返回键
document.addEventListener("backbutton", eventBackButton, false); // 返回键
}, 3000);
}
else {
navigator.app.backHistory();
}
}
//退出app
function exitApp() {
navigator.app.exitApp();
} html中加入了这段代码了,但在模拟器里面试用完全无效 我也一样的 但是我用的是jquery-mobile 这个怎么搞? aaaaa 发表于 2014-8-25 22:28
这个怎么搞?
我把这写添加到index.html后。点击返回键一直都没反应。 额 在ionic怎么用
页:
[1]