如何停止在Android手机上调整软键盘Chrome浏览器窗口大小的功能? [英] How to stop soft keyboard resizing Chrome browser window on Android mobiles?

查看:105
本文介绍了如何停止在Android手机上调整软键盘Chrome浏览器窗口大小的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到这个问题是 此处,但无法找到明确和/或可行的答案.我正在运行Chrome 75的Samsung A7(2018)上使用Android9.

I see this question asked here, here, and here, but could not find a clear and/or workable answer. I'm using Android 9 on a Samsung A7 (2018), running Chrome 75.

会发生什么. 我有一个需要键盘输入的HTML表单.在Chrome中打开并尝试输入时,键盘会强制调整表单大小.调整大小可以将表单减小到屏幕高度的50%,还可以调整表单宽度和输入字段的宽度/高度.在关闭键盘并返回到正常大小之前,看不到任何键入的文本. Firefox Focus中不会调整大小-键盘向上滑动并滑过表单的下半部分,使表单保持100%的大小.

What happens. I have a html form requiring keyboard input. When opened in Chrome and input is attempted, the keyboard forces the form to resize. The resizing reduces the form to about 50% of the screen height and also resizes the form width and the width/height of input fields. Any text typed is not visible until the keyboard is dismissed and the form returns to normal size. The resizing does not happen in Firefox Focus - the keyboard slides up and over the bottom half of the form, leaving the form at 100% size.

更新2019-解决方案! 我在

Update 2019 - Solution! I found the answer to my question about Chrome in a question here about the very same problem, but in Firefox (which isn't a problem any more, at least not now with Firefox Focus 9).

推荐答案

出现了一个很奇怪的问题,即软键盘更改了视口的高度...当前正在处理同一问题...这看起来很有希望,即将实现...它将视口内容设置为显式px值

its an andriod issue where the softkeyboard changes the viewport height...currently working on the same issue...this looks promising, about to implement...it sets the viewport content to explict px values

setTimeout(function () {
    var viewheight = $(window).height();
    var viewwidth = $(window).width();
    var viewport = $("meta[name=viewport]");
    viewport.attr("content", "height=" + viewheight + "px, width=" + 
    viewwidth + "px, initial-scale=1.0");
}, 300);

像魅力一样工作

这篇关于如何停止在Android手机上调整软键盘Chrome浏览器窗口大小的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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