发现键盘是可见的使用jQuery [英] find keyboard is visible using jquery

查看:159
本文介绍了发现键盘是可见的使用jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我已经开发的Andr​​oid应用程序的PhoneGap是responsive.So当键盘是可见的,我需要藏在纵向和横向模式和键盘页脚是不可见的,我需要证明在这两个mode.I页脚都试过了样本,但它不工作fine.If我打开在纵向模式应用程序我不能能找到在横向模式下页脚时,键盘是不可见的。

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.

下面是我的示例code:

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);

请指导me.Thanks提前。

Please guide me.Thanks in Advance.

推荐答案

我觉得你最好的选择是为显示和隐藏键盘事件注册。

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);

这篇关于发现键盘是可见的使用jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆