我不知道该如何描述这就是我录制视频的原因。屏幕上有固定的黄色文字。当键盘不在屏幕上时,固定文本行为是正常的。当我专注于屏幕并且键盘变得可见时,固定元素开始随页面滚动。是错误还是什么?对此有什么解决方案吗?
视频:https://www.youtube.com/watch?v=Nq60jH4XiJs
https://codepen.io/anon/pen/rZgKqG
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=1" />
</head>
<textarea style="min-height: 50px;"></textarea>
<div style="height: 1000px; background-color: green">
div - height 1000px
</div>
<div style="position: fixed; top: 10px; right: 10px; background-color: yellow;">
Some Fixed Text
</div>
</html>
最佳答案
不幸的是,当在页面上使用固定元素时,这是 iOS 中 Safari 的预期行为。
看看这篇提供可能解决方案的文章: https://medium.com/@im_rahul/safari-and-position-fixed-978122be5f29
关于html - 修复了键盘进入屏幕时移动浏览器中的元素问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52485225/