phonegap を使用してデバイスの戻るボタンに機能を追加しています
document.addEventListener("deviceready", onDeviceReady, false);
WL.Logger.debug("Login init");
function onDeviceReady() {
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onBackKeyDown() {
alert("sample1 back button clicked");
$('#page').load("pages/samplepage1.html", function(){
currentPage.init();
});
}
戻るボタンのsample1.htmlページをクリックすると、アラートが表示されます(「sample1の戻るボタンがクリックされました」)その動作は正常です
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onBackKeyDown() {
alert("sample2 back button clicked");
$('#page').load("pages/sample2.html", function(){
currentPage.init();
});
};
sample2.html ページの backbutton をクリックすると、 alert("sample1 back button clicked") が表示されましたが、 alert("sample2 back button clicked") は表示されませんでした。私はこれをjsファイルのcurrentPage.init = function(){}の外側に書きましたwtが問題ですか?w 間違えました
解決策を知っている人がいたら、私に投稿してください。事前に感謝します