我有一个简单CSS的PHP Web应用程序。当我在Android平板电脑上运行该应用程序并尝试登录时,软键盘会弹出并隐藏我的文本输入字段。我尝试在Stack Overflow上搜索类似的问题,但所有问题都与ASP.NET相关,没有具体提到其他语言。
我已经尝试了以下解决方案,但没有起作用:
// 在document.ready函数中添加此代码
if(navigator.userAgent.indexOf('Android') > -1){
$('html').css({ "overflow": "auto !important" });
$('body').css({ "height": "auto !important" });
$('body').css({ "overflow": "auto !important" });
$('.scrollable').css({ "position": "inherit !important" });
$('body').on('focusin', 'input, textarea', function(event) {
//alert("test");
var scroll = $(this).offset();
window.scrollTo(0, scroll);
});
}
或者
//在CSS文件中添加
html {
overflow: auto;
}
body {
height:auto;
overflow: auto;
}
.scrollable {
position:inherit;
}
请帮忙。 谢谢。