移动键盘上方的位置元素 [英] Position element above mobile keyboard

查看:138
本文介绍了移动键盘上方的位置元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在移动键盘的正上方放置一个元素。即:位置绝对/固定在页面底部,但由键盘向上推(或推高键盘的等效高度)。

通常这是相反的行为希望得到什么,而且会有很多人为了保持底层元素而战斗。我觉得我还记得之前在同一场战斗中... ...

但现在我想让它移动,事实并非如此。 (当然!)



现在我的焦点是iOS Safari,但更喜欢跨浏览器。



它似乎老版本的iOS在键盘打开时更改了 window.innerHeight ,无论好坏。但事实不是这样。这可能可以解释为什么我没有看到我期望看到的东西......



我一直在玩各种各样定位的父元素,没有运气。

这甚至有可能吗?或者键盘现在完全脱离了视口?

解决方案

这是不可能的。键盘看起来像是它自己的实体,或者像你说的那样,从视口中分离出来。


I'm trying to position an element directly above a mobile keyboard. ie: position absolute/fixed to bottom of page, but pushed up by the keyboard (or pushed up equivalent height of the keyboard).

Usually this is the opposite behavior of what's desired, and there's to be a lot of people fighting to keep bottom elements in place. I feel like I remember fighting those same battle before...

But now that I want it to move, it's not. (of course!)

My focus is iOS Safari for now, but would prefer cross browser.

It seems older versions of iOS changed window.innerHeight when the keyboard opened, for better or worse. But that's no longer the case. Which may explain why I'm not seeing what I expected to see...

I've been playing around with variously positioned parent elements with no luck.

Is this even possible? Or is the keyboard now completely detached from the viewport?

解决方案

It is not possible. The keyboard appears to be its own entity away, or as you said, detached from the viewport.

这篇关于移动键盘上方的位置元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆