当虚拟键盘出现时,Html输入失去了对三星Android的关注 [英] Html input loses focus on Samsung Android when virtual keyboard appears

查看:160
本文介绍了当虚拟键盘出现时,Html输入失去了对三星Android的关注的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用html5 web应用程序失去三星Galaxy Tab A(Android 7.0)上的输入元素焦点的问题。这似乎是一个问题在Android中,因为在Windows 10或iOS上(虽然resize事件也会在虚拟键盘弹出时触发),但元素不会失去焦点。当调用虚拟键盘时(但不是在手动调整浏览器窗口大小时),Windows 10和iOS显然会抑制这一点。任何人对此有帮助?

解决方案

这是一个由于 resize()事件。






$ b您是否尝试过这种类型的调整大小功能:

$($(input)。)($:$ b $ $ $ $ $ $ $ $ $ $焦点)){
//什么都不会发生
} else {
//其他调整大小函数
}
});


I have the problem of losing focus on an input element on a Samsung Galaxy Tab A (Android 7.0) with a html5 web application. It seems to be a problem in android, as on windows 10 or iOS (although the resize event is also triggered when the virtual keyboard pops up) the element does not lose focus. Windows 10 and iOS apparently suppress this when the virtual keyboard is called (but not when manually resizing the browser window). Anybody any help on this?

解决方案

It's an Android issue losing focus due to the resize() event.

Have you tried something like this for your resize functionality if something is not in focus:

$(window).bind('resize', function() {

    if ($("input").is(":focus")) {
        // Nothing will happen
    } else {
        // Other resize functions
    }
});

这篇关于当虚拟键盘出现时,Html输入失去了对三星Android的关注的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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