Overriding The Back Button In Phonegap Android
I`m trying to accomplish more than one addEventListener, but something is wrong? For example if we have 3 divs on page and first one is displayed on the beginning and other two hid
Solution 1:
try this, on device ready add a listener for backbutton like this
var onBackButton = function(){show_div2();}; //the initial statedocument.addEventListener("backbutton", onBackButton, false);
And
don't use onClick with phoneGap
use href, or ontouchend and be sure that your < a > is visible because you dont have anything inside(display block in your css file)
<divid="d1"><ahref='javascript:onDivClick(1)'style='display:block; width:100%; height:100%;'></a>
// <aontouchend='onDivClick(1)'></a> will be better
</div><divid="d2"><ahref='javascript:onDivClick(2)'style='display:block; width:100%; height:100%;'></a></div>
in javascript
functiononDivClick(varcase)
{
switch(case)
case1:
$('#d1').hide();
$('#d2').show();
onBackButton = function(){show_div1();};
break;
case2:
$('#d2').hide();
$('#d1').show();
onBackButton = function(){show_div2();};
break;
}
Post a Comment for "Overriding The Back Button In Phonegap Android"