我正在与Cordova、Ionic v1和AngularJS 1.5合作一个项目。cordova-ios v 5
我的项目中有一个浮动按钮。除了当我有一个带有文本输入的表单页面时,它对任何事情都很有效。当iOS键盘出现时,我的浮动按钮就消失了。它在Android上运行得很好。
这是我的css:
.floating-button {
position: fixed;
bottom: 20px;
z-index: 9999;
right: 20px;
border-radius: 50%;
height: 60px;
width: 60px;
border: none;
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2), 0 2px 5px 0 rgba(0, 0, 0, 0.2);
color: white;
font-size: 22px;
}

发布于 2019-06-14 21:16:16
您可以这样做来克服这个问题。
使用键盘插件并在键盘上打开和关闭更改底部的css值,这样在键盘打开时,它会自动将浮动按钮移动到上,关闭时移动到下
cordova插件添加cordova- plugin -ionic keyboard--保存
//Keyboard will be shown
window.addEventListener('native.keyboardshow', keyboardShowHandler);
function keyboardShowHandler(e){
console.log('Keyboard height is: ' + e.keyboardHeight);
$(".floating-button").css("bottom", e.keyboardHeight+"px");
// You can use IONIC properties for this and change value as per your requierment
}
//Keyboard will hide
window.addEventListener('native.keyboardhide', keyboardHideHandler);
function keyboardHideHandler(e){
$(".floating-button").css("bottom", "20px");
}https://stackoverflow.com/questions/56597375
复制相似问题