简体   繁体   English

无法输入内部输入元素,因为平板电脑键盘位于其上方(HTML)

[英]Can not type inside input element because tablet Keyboard is above it (HTML)

Lets imagine i have a simple page that looks like this: FIDDLE as you can see my Input fields are fixed at the bottom of the screen, i use this website on a Win10 TabletPc in tablet modus . 让我们想象一下,我有一个看起来像这样的简单页面: FIDDLE你可以看到我的输入字段固定在屏幕的底部, 我在平板电脑模式的Win10 TabletPc上使用这个网站

Now when ever i focus the input fields to type something in, the tablet keyboard pops up as it should and since my inputfields are at the bottom of the screen the keyboard will be shown over it which is not so problemmatic the real problem is that i cannot type anything inside those input fields aslong as the keyboard is over those inputs. 现在,当我将输入字段集中在输入字段时,平板电脑键盘会弹出,因为我的输入字段位于屏幕的底部,键盘将显示在它上面,这不是问题,真正的问题是我只要键盘在这些输入上,就不能在这些输入字段中键入任何内容。 I am not sure if this is a common problem because i couldnt find anything online. 我不确定这是否是一个常见的问题,因为我无法在网上找到任何东西。 I also tried to scroll the inputs up when they are focused but unfortunately this doesnt fix it. 我还尝试在聚焦时滚动输入,但不幸的是,这并没有解决它。 It only works when i refocus the input element and the keyboard is not hideing it. 它仅在我重新聚焦输入元素并且键盘没有隐藏它时才有效。

Any suggestions are appreciated. 任何建议表示赞赏。

HTML HTML

<div id="mainBody">
//content....
</div>

<div id="footer">
<label>Input1<input type="number" /></label>
<br>
<br>
<label>Input2<input type="number" /></label>
<br>
<br>
<label>Input3<input type="number" /></label>
<br>
<br>
<label>Input4<input type="number" /></label>
</div>

CSS CSS

#footer{
  position: fixed;
  bottom:0;
}

Try using z-index:1 or Make a button for the form and show it on the top of the screen so the user can add text to it normally 尝试使用z-index:1或为表单创建一个按钮并将其显示在屏幕顶部,以便用户可以正常添加文本

$(window).load(function() { 
    $('.buttonform').on('click touchstart', function() {
        $('#footer').show();
         $('#buttonform').hide();
    });
});

 <button type="button" class="buttonform">Complete form</button>


    <div id="footer" style="visibility:hidden">
    <label>Input1<input type="number" /></label>
    <br>
    <br>
    <label>Input2<input type="number" /></label>
    <br>
    <br>
    <label>Input3<input type="number" /></label>
    <br>
    <br>
    <label>Input4<input type="number" /></label>
    </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM