1. <tfoot id='BWt8T'></tfoot>
      • <bdo id='BWt8T'></bdo><ul id='BWt8T'></ul>

      <small id='BWt8T'></small><noframes id='BWt8T'>

      <i id='BWt8T'><tr id='BWt8T'><dt id='BWt8T'><q id='BWt8T'><span id='BWt8T'><b id='BWt8T'><form id='BWt8T'><ins id='BWt8T'></ins><ul id='BWt8T'></ul><sub id='BWt8T'></sub></form><legend id='BWt8T'></legend><bdo id='BWt8T'><pre id='BWt8T'><center id='BWt8T'></center></pre></bdo></b><th id='BWt8T'></th></span></q></dt></tr></i><div id='BWt8T'><tfoot id='BWt8T'></tfoot><dl id='BWt8T'><fieldset id='BWt8T'></fieldset></dl></div>

      1. <legend id='BWt8T'><style id='BWt8T'><dir id='BWt8T'><q id='BWt8T'></q></dir></style></legend>

        键盘向上推动一个 div &amp;走出屏幕

        时间:2023-09-30

          <bdo id='EZrPg'></bdo><ul id='EZrPg'></ul>

          <tfoot id='EZrPg'></tfoot>
        • <i id='EZrPg'><tr id='EZrPg'><dt id='EZrPg'><q id='EZrPg'><span id='EZrPg'><b id='EZrPg'><form id='EZrPg'><ins id='EZrPg'></ins><ul id='EZrPg'></ul><sub id='EZrPg'></sub></form><legend id='EZrPg'></legend><bdo id='EZrPg'><pre id='EZrPg'><center id='EZrPg'></center></pre></bdo></b><th id='EZrPg'></th></span></q></dt></tr></i><div id='EZrPg'><tfoot id='EZrPg'></tfoot><dl id='EZrPg'><fieldset id='EZrPg'></fieldset></dl></div>
            • <small id='EZrPg'></small><noframes id='EZrPg'>

                  <tbody id='EZrPg'></tbody>
                <legend id='EZrPg'><style id='EZrPg'><dir id='EZrPg'><q id='EZrPg'></q></dir></style></legend>
                  本文介绍了键盘向上推动一个 div &amp;走出屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在使用 Ionic 3 创建一个网站,该网站将成为 web 视图中另一个本机应用程序的一部分,因此我不使用 cordova 或任何本机插件.我有一个在元素上方嵌入 Google 地图视图的表单,这是我的 HTML:

                  这是我的 CSS:

                   #map_loader {边距:自动;背景颜色:rgba(0, 0, 0, 0.5);宽度:100%;高度:100%;z 指数:1000;位置:绝对;}.滚动内容{最高:38%;位置:绝对;边距顶部:32px;}

                  现在,一旦用户在手机上打开网站并开始填写表单,键盘就会将地图移出屏幕 ( Up ) 并保持这种状态,并且在表单下方显示一个空白区域.

                  我做得对吗?这是因为我的 CSS 造成的吗?让 div 占据屏幕高度的特定百分比的最佳方法是什么?我试过 ion-grid 但它似乎无法帮助我解决这种情况.

                  解决方案

                  这是 ionic 中的错误,一旦你专注于任何输入,键盘就会出现并为 添加 padding-bottom>scroll-content 类将 for 提升到键盘上方,并且在关闭键盘后它不会删除 padding-bottom.我试图检查移动键盘上是否有任何 JS 事件,但我们没有,所以我的解决方法是为 scroll-content 设置一个固定的 padding-bottom类以防止在运行时更改它.

                  .scroll-content {padding-bottom: 0 !important;}

                  I'm using Ionic 3 to make a website which will be part of another native app in a webview so I don't user cordova or any native plugins. I have a form with an embedded Google Map View above the elements and here is my HTML :

                  <div  style="height: 40%; width: 100%">
                    <div id="map_loader" *ngIf="showMapLoader">
                      <div class="sk-wave">
                        <div class="sk-rect sk-rect1"></div>
                        <div class="sk-rect sk-rect2"></div>
                        <div class="sk-rect sk-rect3"></div>
                        <div class="sk-rect sk-rect4"></div>
                        <div class="sk-rect sk-rect5"></div>
                      </div>
                    </div>
                    <div #mapCanvas style="width: 100%; height: 100%;"></div>
                  </div>
                  <form (ngSubmit)="submit()" padding>
                    <ion-list>
                  ......
                  ......
                  .....
                    </ion-list>
                  </form>
                  

                  and here is my CSS :

                    #map_loader {
                      margin:auto;
                      background-color: rgba(0, 0, 0, 0.5);
                      width: 100%;
                      height: 100%;
                      z-index: 1000;
                      position: absolute;
                    }
                  
                    .scroll-content {
                      top: 38%;
                      position: absolute;
                      margin-top: 32px;
                    }
                  

                  Now once the user open the website on his phone and start filling the form the keyboard shifts the map out of the screen ( Up ) and it stays that way and a blank empty space shows bellow the form.

                  Am I doing it right? Is that happening because of my CSS? and what is the best way to make a div takes a specific percentage of the screen height? I tried ion-grid but it seems that it can't help me for this case.

                  解决方案

                  it's bug in ionic, once you focus on any input the keyboard will show up and will add padding-bottom for the scroll-content class to lift the for above the keyboard and it doesn't remove the padding-bottom after you close the keyboard. I tried to check if I have any JS event on the mobile keyboard but we don't so my work around is to set a fixed padding-bottom for the scroll-content class to prevent changing it on the runtime.

                  .scroll-content {
                      padding-bottom: 0 !important;
                   }
                  

                  这篇关于键盘向上推动一个 div &amp;走出屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  <small id='rElmG'></small><noframes id='rElmG'>

                    <tbody id='rElmG'></tbody>
                    • <bdo id='rElmG'></bdo><ul id='rElmG'></ul>
                      <legend id='rElmG'><style id='rElmG'><dir id='rElmG'><q id='rElmG'></q></dir></style></legend>

                        <i id='rElmG'><tr id='rElmG'><dt id='rElmG'><q id='rElmG'><span id='rElmG'><b id='rElmG'><form id='rElmG'><ins id='rElmG'></ins><ul id='rElmG'></ul><sub id='rElmG'></sub></form><legend id='rElmG'></legend><bdo id='rElmG'><pre id='rElmG'><center id='rElmG'></center></pre></bdo></b><th id='rElmG'></th></span></q></dt></tr></i><div id='rElmG'><tfoot id='rElmG'></tfoot><dl id='rElmG'><fieldset id='rElmG'></fieldset></dl></div>

                          <tfoot id='rElmG'></tfoot>