1

Hi I have developed android phonegap app which is responsive.So when keyboard is visible i need to hide the footer in portrait and landscape mode and keyboard is not visible i need to show the footer in both the mode.I have tried the sample but its not working fine.If i open the app in portrait mode i cant able to find the footer in landscape mode when keyboard is not visible.

Here is my sample code:

var is_keyboard = false;
var is_landscape = false;
var initial_screen_size = window.innerHeight;

/* Android */
window.addEventListener("resize", function() {
is_keyboard = (window.innerHeight < initial_screen_size);
is_landscape = (screen.height < screen.width);
if (is_keyboard) 
{
    $("#footer1").hide();
}
else
{
    $("#footer1").show();
}

}, false);

Please guide me.Thanks in Advance.

1 Answer 1

3

I think your best bet is to register for the show and hide keyboard events.

document.addEventListener("showkeyboard", function() {
    $("#footer1").hide();
}, false);

document.addEventListener("hidekeyboard", function() {
    $("#footer1").show();
}, false);
Sign up to request clarification or add additional context in comments.

2 Comments

thanks for your reply.I have tried this in phonegap 2.1 and its working fine.Can this work in latest phonegap version cordova-2.3
Hi Simon - are these events part of PhoneGap/Cordova "core" or do they come from a 3rd party plugin? I've seen mention of these in a few different places, but I'm having trouble finding where these come from. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.