简体   繁体   English

键盘在IOS App中通过IONIC隐藏页脚

[英]Hide footer when keyboard appear in IOS App via IONIC

I have an issue with the footer-bar, when an input is focused ( in the ion-content ) the keyboard appear and the footer stay above the keyboard. 我的页脚栏有问题,当输入被聚焦时(在离子内容中)键盘出现并且页脚停留在键盘上方。 The thing is that it hides what is under the input, particularly in landscape mode, and so hide the popover that appear under the focused input. 问题在于它隐藏了输入下的内容,特别是在横向模式下,因此隐藏在焦点输入下出现的弹出窗口。

Anyone know how to solve this problem? 有谁知道如何解决这个问题? Can I hide the footer when the keyboard appear? 键盘出现时可以隐藏页脚吗?

Thanks 谢谢

SET 
cordova.plugins.Keyboard.disableScroll(true); 
AS 
cordova.plugins.Keyboard.disableScroll(false);
inside ur app.js file.
this code worked for me.try it out.

From Ionic docs : 来自Ionic docs

To hide an element when the keyboard is open, add the class hide-on-keyboard-open. 要在键盘打开时隐藏元素,请添加类hide-on-keyboard-open。

<div class="hide-on-keyboard-open"> <div id="google-map"></div> </div>

So basically you just have to add this class to your footer. 所以基本上你只需要将这个类添加到你的页脚。

  1. Declare a document variable like this:- 声明一个这样的文档变量: -

    declare var document:any; 声明var文件:any;

  2. Subscribe for keyboard show and hide events using native keybaord plugin like this:- 使用本机keybaord插件订阅键盘显示和隐藏事件,如下所示: -

    Keyboard.onKeyboardShow().subscribe( (value)=>{ document.body.classList.add('hide-on-keyboard-open'); } Keyboard.onKeyboardShow()。subscribe((value)=> {document.body.classList.add('hide-on-keyboard-open');}

    Keyboard.onKeyboardHide().subscribe( (value)=>{ document.body.classList.remove('hide-on-keyboard-open'); } Keyboard.onKeyboardHide()。subscribe((value)=> {document.body.classList.remove('hide-on-keyboard-open');}

  3. Add css :- 添加css: -

    body.hide-on-keyboard-open .scroll-content{ margin-bottom: 0px !important; body.hide-on-keyboard-open .scroll-content {margin-bottom:0px!important; } }

    body.hide-on-keyboard-open .footer{ display: none; body.hide-on-keyboard-open .footer {display:none; } }

THATS IT, YOU'RE GOOD TO GO THIS WORKS PERFECT 100%. 就是这样,你可以完美地完成这项工作100%。

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

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